Skip to content

Instantly share code, notes, and snippets.

@CraftyFella
Last active December 18, 2015 14:49
Show Gist options
  • Save CraftyFella/5800032 to your computer and use it in GitHub Desktop.
Save CraftyFella/5800032 to your computer and use it in GitHub Desktop.
Understanding new in Java script vs bind
function Customer(name, age)
{
this.name = name;
this.age = age;
}
var dave = new Customer("Dave", 35)
Dump(dave);
var jax = {};
Customer.bind(jax, "Jax", 29)();
Dump(jax);
function Dump(customer)
{
alert(customer.name);
alert(customer.age);1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment