Skip to content

Instantly share code, notes, and snippets.

@aosalias
Created November 8, 2016 19:44
Show Gist options
  • Save aosalias/c76557550ea65b7a64ec7a987fed6893 to your computer and use it in GitHub Desktop.
Save aosalias/c76557550ea65b7a64ec7a987fed6893 to your computer and use it in GitHub Desktop.
Interview Question for JS fundamentals
function myBind() {
var args = Array.slice(arguments);
var func = arguments.pop()
var that = arguments.pop()
return ;
}
// currying
var add = function(...) { return x + y; }
var add3 = myBind(add, null, 3);
add3(4) === 7;
// curry 'this'
addThis = function(x) { return x + this.x; }
var add3This = myBind(addThis, {x: 3})
add3This(4) === 7
@aosalias
Copy link
Author

aosalias commented Nov 8, 2016

Potentially ask them to implement add with an arbitrary number of arguments

potentially ask them to implement a test plan

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