Skip to content
Permalink
bb11685aea
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
59 lines (47 sloc) 1.04 KB
const person = {
name: ['Bob', 'Smith'],
age: 32,
bio() {
console.log(`${this.name[0]} ${this.name[1]} is ${this.age} years old.`);
},
introduceSelf() {
console.log(`Hi! I'm ${this.name[0]}.`);
}
};
const person1 = {
name: 'Chris',
introduceSelf() {
console.log(`Hi! I'm ${this.name}.`);
}
}
const person2 = {
name: 'Deepti',
introduceSelf() {
console.log(`Hi! I'm ${this.name}.`);
}
}
function createPerson(name) {
const obj = {};
obj.name = name;
obj.introduceSelf = function() {
console.log(`Hi! I'm ${this.name}.`);
}
return obj;
}
function Person(name) {
this.name = name;
this.introduceSelf = function() {
console.log(`Hi! I'm ${this.name}.`);
}
}
const salva = new Person('Salva');
salva.name;
salva.introduceSelf();
const frankie = new Person('Frankie');
frankie.name;
frankie.introduceSelf();
const myDiv = document.createElement('div');
const myVideo = document.querySelector('video');
const myDataName = 'height';
const myDataValue = '1.75m';
person[myDataName] = myDataValue;