Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jasonm23
Last active February 4, 2016 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jasonm23/4f6b35410efe07fdaf92 to your computer and use it in GitHub Desktop.
Save jasonm23/4f6b35410efe07fdaf92 to your computer and use it in GitHub Desktop.

JavaScript Developer Questionnaire

1. What will be the value of b?

var r = undefined;
a = b = c = 20;
n = i = r;

2. Describe each part of a for loop structure.

3. Examine this for loop.

for(i = 0; i < n; i++){
  b = i;
}

3.1 Explain at least 3 things wrong with it.

3.2 What will be the value of b?

4. After the following code has run what will be the value of x?

var x = true && true && true && false;

5. After running the code below:

var x = 0;

function multiply(a, b){
  var x = a * b;
  return x;
}

var z = multiply(20, 10);

5.1 What will be the value of x?

5.2 What will be the value of z?

6. After running the code below:

(function(){
  b = 20;
  var a = 10 * b;
  return a;
})();

6.1 what will be the value of b?

6.2 What will be the value of a?

7. What will be the value of a?

a = 10;
a /= 2;

8. What will be the value of a['foo']?

var a = { bar: 10, baz: 20, foo: 40 };
a.foo += a.bar;

9. What will be the value of a[3]?

var a = "I ran all the way home";

10. What will be the value of b[3]?

var b = "I ran all the way home".split(' ');

11. What will be the value of m?

var m = /test/.test("I know this is a test");

12. After running the code below:

Object.prototype.mush = function(){
  var b = 0, c = [];
  if(this instanceof Array){
    b = this.reduce(function(s,i){ return s + i; });
    c = this.map(function(i){ return b; });
  }
  return c;
}

a = [1,2,3,4,5,6,7];

a.mush();

b = a[2];

12.1 What will be the value of b?

12.2 What will be the value of a.mush()[2]?

12.3 What will be the value of b == a.mush()[2]

@d0minicw0ng
Copy link

How about a question on 'this'?

var a = function(name){
  this.name = name;
  this.sayName = function(){
    console.log("Hello: ", this.name);
    return function(){
      console.log("Hello: ", this.name);
    }();
  }
}

obj = new a('Dominic');
obj.sayName();

What does obj.sayName() return?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment