random Flashcards

1
Q

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);
A

objects are assigned by reference.

// 456 TS Ave

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

assign by value or reference?

var myName = "Kyle";
var yourName = myName;
myName = "Frank";

console. log(myName);
console. log(yourName);

A

primitives are always copied as value

// Frank
// Kyle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

whats the difference between call and apply

A

theFunction.apply(valueForThis, arrayOfArgs)

theFunction.call(valueForThis, arg1, arg2, …)

apply is useful for passing arguments through wrapper functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what does it mean for a property to shadow

A

when an object’s prototype has a property defined, and also defines that property, cutting off prototype lookup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

difference between target and currentTarget

A

target initiated the event

currentTarget has the event handler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does screen x/y measure

A

this measurement is relative to the computers screen, not just the browser window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does offset x/y measure

A

this measures the distance from the edge of the element to the click location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does client x/y measure

A

this is measurement from the edge of the window to the click location, even if content is scrolled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does pagex measure

A

this is the distance from the edge of the page, even if the top is scrolled out of the window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly