Skip to content

Instantly share code, notes, and snippets.

@fschwiet
Last active December 23, 2015 11:19
Show Gist options
  • Save fschwiet/6627425 to your computer and use it in GitHub Desktop.
Save fschwiet/6627425 to your computer and use it in GitHub Desktop.
Quick reference for Javascript's apply, call and related functions.
Function.prototype.apply(thisArg[, argsArray])
Function.prototype.call(thisArg[, arg1[, arg2[, ...]]])
Q.nfcall(FS.readFile, "foo.txt", "utf-8");
Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
Q.ninvoke(FS, "readFile", "foo.txt", "utf-8");
Q.npost(FS, "readFile", ["foo.txt", "utf-8"]);
Q.nbind(FS.readFile, FS)("foo.txt", "utf-8");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment