Skip to content

Instantly share code, notes, and snippets.

@stevez
Created October 17, 2011 03:26
Show Gist options
  • Save stevez/1291876 to your computer and use it in GitHub Desktop.
Save stevez/1291876 to your computer and use it in GitHub Desktop.
var F = function() {};
F.prototype.a = 'b';
var s = new F();
print(s.a);
print(s.hasOwnProperty('a')); //false
s.a = 'c'; // object s will create its new property 'a'
print(s.a); // c
print(s.hasOwnProperty('a')); // true;
print(F.prototype.a); //b; property in F is not changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment