You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
439 B
19 lines
439 B
1 year ago
|
// we need a way to build these automatically
|
||
|
const Person = (name, age, eyes) => {
|
||
|
// this makes an obj for the data
|
||
|
let obj = {
|
||
|
name: name,
|
||
|
age: age,
|
||
|
eyes: eyes
|
||
|
}
|
||
|
|
||
|
// then attach our function to it
|
||
|
obj.talk = (words) => {
|
||
|
// coolest part is obj here will keep a reference
|
||
|
console.log(`I am ${obj.name} and ${words}.`);
|
||
|
}
|
||
|
|
||
|
// and return our new person
|
||
|
return obj;
|
||
|
}
|