Objects function 'this' Flashcards
When a function is invoked a new ________ context is created.
execution
Every time a _____ is run, ‘this’ variable is created.
function
Argument
The parameters you pass to a function
Does JavaScript pass variables by reference or by value?
Yes, primitive types are passed by value.
Primitive types are passed by ______. and Objects are passed by ______.
reference
What does passed-by value mean?
If you change the value of a primitive type inside a function, the changes won’t affect the variable in the outer scope. Because you passed a copy set in different locations.
What does passed-by reference mean?
You’re passing something that points to something else vs the copy. Any changes made to that reference will also be changed in the outer scope.
== is called?
double equal
=== is called?
strict equal
strict equal checks for?
both type as well as value equality
double equal checks for?
only checks for the equality of the values.
Why does the js engine produce “true” for 0==’0’?
A double equality only checks for the value so the engine tries to convert the number on the left side of the equal sign to a string.
How do you check if a type is a number?
isNaN();
NaN == NaN produces and why?
false. type coercion. It’s coercing NaN into a string to check if its a number.
undefined == null produces what result.
True. undefined is null and null is undefined