Skip to content

Instantly share code, notes, and snippets.

@vernonk
Last active December 26, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vernonk/22b6a038e41c479b0059 to your computer and use it in GitHub Desktop.
Save vernonk/22b6a038e41c479b0059 to your computer and use it in GitHub Desktop.
JavaScript Questions
// Why would you need this?
function hasHair () {
var args = Array.prototype.slice.call( arguments );
}
// What output values do these console.log statements give you?
console.log( typeof isAwesome );
console.log( typeof lovesJava );
console.log( typeof isHired );
function isAwesome () { return true; }
window.lovesJava = function () { return false; };
var isHired = function () { return true; };
// What is the result of the invocation of sayHi within the greeting function?
// Why?
function greeting () {
sayHi( "Paul" );
return;
function sayHi ( name ) {
console.log( "Hi", name );
}
}
A series of JavaScript related questions to be used during technical interviews.
function isAwesome () {
console.log( this );
}
var Person = function () {
console.log( this );
};
var obj = {};
// What is the context of `this` in the following scenarios?
var jon = Person();
var terence = new Person();
isAwesome();
isAwesome.bind( obj )();
isAwesome.call( obj );
isAwesome.apply( this );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment