Возврат в for
l oop скоро завершит l oop.
Но для создания разделенной пробелами строки лучше сделать с объединением.
this.personality = function() {
return this.name.first + ' is ' + this.caracteristic.join(' ');
}
Тем не менее, вместо функции, вы также можете использовать Class для этого.
Пример фрагмента:
class People {
constructor (first, last, age, gender, interest, caracteristic) {
this.name={
first: first,
last: last
};
this.age = age;
this.gender = gender;
this.interest = interest;
this.caracteristic = caracteristic;
}
bio = () => `${this.name.first} ${this.name.last} is ${this.age}.Is ${this.gender} and likes ${this.interest}`;
greeting = () => `Hi! I'm ${this.name.first}.`;
personality = () => `${this.name.first} is ${this.caracteristic.join(' ')}`;
}
let people1 = new People(
'Sandra', 'Stward', 47, 'female',
['arts', 'cinema', 'poetry', 'photography', 'arts and crafts', 'painting', 'drawing', 'creative art'],
['kind', 'clever', 'sweet', 'empathic', 'emotive', 'hight9 sensitive person']
);
console.log(people1.name)
console.log(people1.bio())
console.log(people1.greeting())
console.log(people1.personality())