Skip to content

Instantly share code, notes, and snippets.

@DmitryMasley
Last active October 24, 2016 10:30
Show Gist options
  • Save DmitryMasley/3a1cc6edf290f5daa8c66069d95512cb to your computer and use it in GitHub Desktop.
Save DmitryMasley/3a1cc6edf290f5daa8c66069d95512cb to your computer and use it in GitHub Desktop.
test
// what will output console.log?
// how to fix the issue?
function Person (name) {
if (name) {
this.options.name = name;
}
};
Person.prototype.options = {
name: 'Default name'
};
var foo = new Person('foo');
var bar = new Person('bar');
console.log(foo.options.name);
console.log(bar.options.name);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment