• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/18

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

18 Cards in this Set

  • Front
  • Back
"this" keyword
Refers to the object that owns the code that is currently running. In an event handler it refers to the object that triggered the event.
register an event handler
myElement.onClick = myEventHandler where myEventHandler() is a function
global variables
variables available to all other areas of the program from the moment they are defined until the page is closed.
local variables
variables scoped to be available only in the code block where they are declare until the execution leaves the code block.
Basic IIFE syntax
(function() {// hidden code and objects go here })();
IIFE (immediate invoked function expression)
keeps objects out of global namespace by declaring an anonymous function and then immediately exectuing it.
Basic Revealing Module Pattern Syntax
var myModule = (function() { var x = 1; var y = 2; var myFunction = function() { return x + y; };return { getX: function() { return x; }, // public getter for X setX: function( newX) { x = newX; }, // public setter for X myFunction : myFunction // make myFunction public } })();
Revealing Module Pattern
Keeps objects out of global namespace by using IIFE but returning an object that has accessible properties and methods.
Common javascript native objects
Array, Date, Math, RegExp, String
Math Object
A static native javascript object for performing mathmatical functions like Math.PI or Math.sqrt(16);
Create new instance of native object
var myArray = new Array();
Call toUpperCase() String object method
var myString = new String("hello"); myString.toUpperCase(); or "hello".toUpperCase();
Create a custom object
var Cat = function(size, color) { this.size = size; this.color = color; } and var myCat = new Cat("fat", "white");
Prototypes
represent the definition of the object type, like a blueprint, and changing the prototype changes all of the objects that were built from it.
Prototype function
Cat.prototype.meow = function(volume) { this.volume = volume; }
Prototype property
Cat.prototype.name = 'Whiskers';
Custom Methods for native objects syntax
String.prototype.GetFirstChar = function() { return this.charAt(0); } and myString.GetFirstChar();
Inherit From an Object
function RaceCar( topspeed) { Car.call( this); // call our base class constructor to inherit from that class this.topspeed = topspeed; // extend with our new properties }