random Flashcards
assign by value or reference?
var myAddress = { street: "123 JS Blvd", city: "Austin", state: "TX" }; var yourAddress = myAddress; myAddress.street = "456 TS Ave"; console.log(yourAddress.street);
objects are assigned by reference.
// 456 TS Ave
assign by value or reference?
var myName = "Kyle"; var yourName = myName; myName = "Frank";
console. log(myName);
console. log(yourName);
primitives are always copied as value
// Frank // Kyle
whats the difference between call and apply
theFunction.apply(valueForThis, arrayOfArgs)
theFunction.call(valueForThis, arg1, arg2, …)
apply is useful for passing arguments through wrapper functions
what does it mean for a property to shadow
when an object’s prototype has a property defined, and also defines that property, cutting off prototype lookup.
difference between target and currentTarget
target initiated the event
currentTarget has the event handler
what does screen x/y measure
this measurement is relative to the computers screen, not just the browser window
what does offset x/y measure
this measures the distance from the edge of the element to the click location
what does client x/y measure
this is measurement from the edge of the window to the click location, even if content is scrolled
what does pagex measure
this is the distance from the edge of the page, even if the top is scrolled out of the window