Skip to content

Instantly share code, notes, and snippets.

@rpbaltazar
Forked from jasonm23/Questions.JavaScript.md
Last active August 30, 2018 05:46
Show Gist options
  • Select an option

  • Save rpbaltazar/9afeaabbe112ab74ee04 to your computer and use it in GitHub Desktop.

Select an option

Save rpbaltazar/9afeaabbe112ab74ee04 to your computer and use it in GitHub Desktop.

JavaScript Developer Questionnaire

1) What is the value of b?

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

2) Describe each part of a for loop structure.

3) Explain at least 3 things wrong this for loop.

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

4) What willl be the final value of b?

5) What will be the value of x?

var x = 0;

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

var z = multiply(20, 10);

6) What will be the value of b? What will be the value of a?

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

7) What will the value of a?

a = 10;
a /= 2;

8) What is the value of a['foo']?

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

8) What is the value of a[3]?

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

9) What is the value of b[3]?

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

10) What is the value of m?

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

11) What is the value of b? What is the value of a.mush()[2]?

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];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment