Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
JavaScript illustrates that methods are the same as functions with an implicit parameter "this"
var completeSale = function(num) {
console.log("Sale " + num + ": selling " + this.items + " to " + this.customer);
var foo = {
customer: "Fred",
items: ["carrot","eggs"],
complete: completeSale
console.log("method style:")
console.log("function style:"), 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.