The following snipped is modified from MDN
const person = {
name: ['Bob', 'Smith'],
age: 32,
gender: 'male',
interests: ['music', 'skiing'],
bio: function() {
console.log(name[0] + ' ' + this.name[1] + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.');
},
greeting: function() {
alert('Hi! I\'m ' + name[0] + '.');
}
};
person.bio();
person.greeting();
Notice that I removed this
from before name[0]
. When I do this, Bob
is output as J
? WTF? :|
There isn't even a capital 'J' anywhere in the code? What is going on???