Skip to content

Instantly share code, notes, and snippets.

@toranb
Created August 3, 2012 22:43
Show Gist options
  • Select an option

  • Save toranb/3252318 to your computer and use it in GitHub Desktop.

Select an option

Save toranb/3252318 to your computer and use it in GitHub Desktop.
How the new keyword works in javascript part 1
var Animal = function(omnivore) {
this.omnivore = omnivore;
}
var human = new Animal(true);
console.log("the human is an omnivore " + human.omnivore);
//this will print "the human is an omnivore true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment