Foundation Flashcards

1
Q

What does the console show: function foo() { return “bar”; } console.log( foo() );

A

bar

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

How do you access the beta property value in this code? let foo = { alpha: 1, beta: 2 };

A

foo.beta

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

What is the value of result?

let places = [{ city: ‘Amsterdam’, europe: true }, { city: ‘Paris’, europe: true }, { city: ‘Sacramento’, europe: false }];

let result = places[2].city;

A

Sacramento

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

Which DOM function returns an element based on its id attribute?

A

document.getElementById( id );

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

How many times will this loop execute?

let count = 5;

while (count) { console.log(count); count–; }

A

5

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

What shows in the console?

var message = “no”;

function foo(message) {

message = “yes”;

}

foo( message );

console.log( message );

A

no

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

T/F: A String is a iterable object

A

True. A String can be thought of as an array of characters

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

What is the output of the following:

function stringToArray(){

let productNumber = “ABC-123”

let values = [… productNumber]

return values; }

A

[“A”,” B”, “C”, “-“, “1”,” 2”, “3”]

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

What happens when you use spread operator to copy an object?

A

The new array is created, but the underlying objects are still the objects being referenced. So any operation performed on the copied array actually changes the referenced object.

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

What are primitive types in JavaScript?

A
  • Data that is NOT an object and has no methods
  • Boolean
  • Undefined
  • Number
  • BigInt
  • String
  • Symbol
  • Null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly