• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/8

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

8 Cards in this Set

  • Front
  • Back

Question: What is the value of foo?


var foo = 10 + '20';

foo = "1020";

Question: How would you make this work?


add(2, 5); // 7


add(2)(5); // 7

var add = function(a, b) {


return a + b;


};


for second function... (https://www.reddit.com/r/javascript/comments/2t6riw/a_frontend_developer_interview_question_thats/)



Question: What value is returned from the following statement?


"i'm a lasagna hog".split("").reverse().join("");

"goh angasal a m'i"

Question: What is the value of window.foo?


( window.foo || ( window.foo = "bar" ) );

it is a check to see if a foo function exists in the window. if it doesn't, then set it to "bar"

Question: What is the outcome of the two alerts below?


var foo = "Hello";


(function() {


var bar = " World";


alert(foo + bar);


})();


alert(foo + bar);

first alert: "Hello World";


second alert: ReferenceError, bar not defined

Question: What is the value of foo.length?


var foo = [];foo.push(1);foo.push(2);

foo.length = 2;

Question: What is the value of foo.x?


var foo = {n: 1};


var bar = foo;


foo.x = foo = {n: 2};

foo.x = undefined


setting foo.x = foo is resetting the value of foo all together, so foo.x no longer exists on the new foo


(http://stackoverflow.com/questions/32342809/javascript-code-trick-whats-the-value-of-foo-x)

Question: What does the following code print?


console.log('one');


setTimeout(function() {


console.log('two');


}, 0);


console.log('three');

"one";


"three";


"two";


the callback provided (setTimeout) is queued, even if the delay specified is zero.