Lesson 4: More Functions Flashcards

1
Q

What is a Variable Scope?

A

The range of JavaScript code in which a variable is visible / accessible.

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

Global Variables are:

A

Declared with var outside of any function.

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

Local Variables are:

A

Declared with var in a function only visible in the function.

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

What does the ‘this’ keyword refer to?

A

The object that the event handler is attached to.

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

What is Hoisting?

A

Moving a variable and function declarations to the top of the current scope.

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

What should be used instead of Variable Hoisting?

A

let and const

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

What are Arrow Functions?

A

Simplified notation for anonymous functions.

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

Show an example of Arrow Functions:

A

var sayHello= () => alert(‘Hello’);

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

What are Default Parameters?

A

Values used by the function if no arguments are provided when it’s invoked.

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

What does a const declaration do?

A

Creates a constant-a value that can’t be changed by reassignment or redeclaration.

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