Skip to content

Instantly share code, notes, and snippets.

@etiennecl
Created June 4, 2020 15:22
Show Gist options
  • Save etiennecl/38566017d9fc65b75ec629407771881a to your computer and use it in GitHub Desktop.
Save etiennecl/38566017d9fc65b75ec629407771881a to your computer and use it in GitHub Desktop.
Skills Test Javascript

Skills Test JavaScript

The first part is a set of technical questions related to fundamental knowledge of javascript.

Fundamental Questions

Question 1: What is printed in the console?

var foo = function foo() {
  console.log(foo === foo);
};
foo();
  1. true
  2. false
  3. ReferenceError

Question 2: What does the above alert?

function aaa() {
  return;
  {
    test: 1;
  }
}
alert(typeof aaa());
  1. function
  2. number
  3. object
  4. undefined

Question 3: What is the result?

Number("1") - 1 == 0;
  1. true
  2. false
  3. TypeError

Question 4: What is the result?

true + false > 2 + true;
  1. true
  2. false
  3. TypeError
  4. NaN

Question 5: What is alerted?

function bar() {
  return foo;
  foo = 10;
  function foo() {}
  var foo = "11";
}
alert(typeof bar());
  1. number
  2. function
  3. undefined
  4. string
  5. Error

Question 6: What is the result?

"1" - -"1";
  1. 0
  2. 2
  3. 11
  4. "11"

Question 7: What is the order of values alerted?

var x = 3;

var foo = {
  x: 2,
  baz: {
    x: 1,
    bar: function () {
      return this.x;
    },
  },
};

var go = foo.baz.bar;

alert(go());
alert(foo.baz.bar());
  1. 1, 2
  2. 1, 3
  3. 2, 1
  4. 2, 3
  5. 3, 1
  6. 3, 2

Question 8: What is the result?

new String("This is a string") instanceof String;
  1. true
  2. false
  3. TypeError

Question 9: What is the result?

[] + [] + "foo".split("");
  1. "f, o, o"
  2. TypeError
  3. ["f", "o", "o"]
  4. [][]["f", "o", "o"]

Question 10: What is the result?

new Array(5).toString();
  1. ",,,,"
  2. []
  3. "[]"

Question 11: What is printed in the console?

var myArr = ["foo", "bar", "baz"];
myArr.length = 0;
myArr.push("bin");
console.log(myArr);
  1. ['foo','bar','baz']
  2. ['foo','bar','baz','bin']
  3. ['bin','foo','bar','baz']
  4. ['bin']

Question 12: What is the result?

String("Hello") === "Hello";
  1. true
  2. false
  3. TypeError

Question 13: What is printed on the console?

var x = 0;
function foo() {
  x++;
  this.x = x;
  return foo;
}
var bar = new new foo()();
console.log(bar.x);
  1. ReferrenceError
  2. TypeError
  3. undefined
  4. 0
  5. 1

Question 14: What is the result?

"This is a string" instanceof String;
  1. true
  2. false
  3. TypeError

Question 15: What is the result?

var bar = 1,
  foo = {};

foo: {
  bar: 2;
  baz: ++bar;
}
foo.baz + foo.bar + bar;
  1. ReferenceError
  2. TypeError
  3. undefined
  4. NaN
  5. 4
  6. 5

Question 16: What is the result?

var myArr = ["foo", "bar", "baz"];
myArr[2];
console.log("2" in myArr);
  1. true
  2. false
  3. ReferenceError

Question 17: What value is alerted?

var arr = [];
arr[0] = "a";
arr[1] = "b";
arr.foo = "c";
alert(arr.length);
  1. 1
  2. 2
  3. 3
  4. undefined

Question 18: What is the result?

10 > 9 > 8 === true;
  1. true
  2. false

Question 19: What value is alerted?

function foo(a, b) {
  arguments[1] = 2;
  alert(b);
}
foo(1);
  1. 2
  2. undefined
  3. ReferenceError

Question 20: What is the result?

NaN === NaN;
  1. true
  2. false
  3. TypeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment