Tricky JS Quiz


A few tricky JS questions.

 

What will be printed?

'use strict'; console.log(name); function sayHello(name){ console.log("Welcome +" + name); }

What will be the output of the below code?

console.log(myName); function printName(myName){ console.log(myName); } myName = 'My Name';

What will be the output on console?

console.log(typeof executeLater); var executeLater = function(){ console.log("executeLater"); }

What will be the output for console.log?

console.log(typeof CSS); function applyCss(element, CSS){ console.log("Apply CSS for element"); } applyCss('#myelement', 'color:red');

What will be the output for 'o'?

var length = 5; var getTotal = function(){ return this.length; } var obj = { length:7, elements:[] }; obj.elements.push(getTotal); var o = obj.elements[0](); console.log(o);

You may also like

Sponsored

Follow me

Popular posts