Получить значение свойства
Добавь объекту atTheOldToad метод getPotions(), который просто возвращает значение свойства potions.Значение свойства atTheOldToad.getPotions это метод объекта Вызов метода atTheOldToad.getPotions() возвращает ['Speed potion', 'Dragon breath', 'Stone skin'] Задания
const atTheOldToad = {
// Change code below this line
potions: ['Speed potion', 'Dragon breath', 'Stone skin'],
// Change code above this line
};
Мой метод (не совсем понял суть задания)
const atTheOldToad = {
// Change code below this line
potions: ['Speed potion', 'Dragon breath', 'Stone skin'],
getPotions = [...potions]
// Change code above this line
};
Ответы (1 шт):
Автор решения: WalkMess
→ Ссылка
const atTheOldToad = {
// Change code below this line
potions: ['Speed potion', 'Dragon breath', 'Stone skin'],
getPotions() {
return this.potions;
}
// Change code above this line
};
console.log(atTheOldToad.getPotions())