Advanced Concepts Problems Flashcards

1
Q

All:
https://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/

A

https://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/

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

Hoisting and the var Statement:
https://launchschool.com/lessons/43f23069/assignments/39f50f91

A

https://launchschool.com/lessons/43f23069/assignments/39f50f91

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

Strict Mode
Problem at bottom of page
https://launchschool.com/gists/406ba491

A

https://launchschool.com/gists/406ba491

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

Closures:
https://launchschool.com/lessons/43f23069/assignments/9362d2cf

A

https://launchschool.com/lessons/43f23069/assignments/9362d2cf

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

Private data,
at bottom of page:
https://launchschool.com/lessons/43f23069/assignments/3df10c91

A

https://launchschool.com/lessons/43f23069/assignments/3df10c91

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

IIFE
https://launchschool.com/lessons/43f23069/assignments/69bab49c

A

https://launchschool.com/lessons/43f23069/assignments/69bab49c

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

Shorthand:
https://launchschool.com/lessons/43f23069/assignments/c6c682cd

A

https://launchschool.com/lessons/43f23069/assignments/c6c682cd

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

do this but with no conditional statements

A

https://launchschool.com/exercises/81b953d7?track=javascript

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

do this (doesn’t work so good with hidden data)
https://launchschool.com/exercises/d30df1f2?track=javascript

A

https://launchschool.com/exercises/d30df1f2?track=javascript

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

Advanced concepts quiz:
https://launchschool.com/quizzes/a669620d

A

https://launchschool.com/quizzes/a669620d

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

What does this do?
var foo = 10;

function bar() {
if (foo > 20) {
var foo = 50;
}

console.log(foo);
foo += 10;
}

bar();
bar();
bar();

A

The declaration for foo on line 5 of the original code gets hoisted to a function-scoped variable, foo, that shadows the foo variable on line 2. Since we’re not initializing the variable inside bar, its value is undefined, and that’s what gets logged each time we execute line 8 in the original code.

function bar() {
var foo;
if (foo > 20) {
foo = 50;
}

console.log(foo);
foo += 10;
}

var foo;
foo = 10;

bar();
bar();
bar();

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

The following code has console.log calls on lines 1, 4, 8, 10, and 16. In what sequence will those 5 log calls execute? (or not at all?)

console.log(foo());

function foo() {
console.log(‘Waiting for bar!’);
}

function foo() {
console.log(foo);
function bar() {
console.log(‘bar again’);
}

bar();

function bar() {
console.log(‘bar again and again’);
}
}

A

8 16 1

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