Lesson 4: More Functions Flashcards
What is a Variable Scope?
The range of JavaScript code in which a variable is visible / accessible.
Global Variables are:
Declared with var outside of any function.
Local Variables are:
Declared with var in a function only visible in the function.
What does the ‘this’ keyword refer to?
The object that the event handler is attached to.
What is Hoisting?
Moving a variable and function declarations to the top of the current scope.
What should be used instead of Variable Hoisting?
let and const
What are Arrow Functions?
Simplified notation for anonymous functions.
Show an example of Arrow Functions:
var sayHello= () => alert(‘Hello’);
What are Default Parameters?
Values used by the function if no arguments are provided when it’s invoked.
What does a const declaration do?
Creates a constant-a value that can’t be changed by reassignment or redeclaration.