У меня возникли проблемы с добавлением массива phrases в метод addPhraseToDisplay ().Вот массив:
class Game {
constructor() {
this.missed = 0; // this property will be used as a counter for the total of 5 tries
this.phrases = ["life is strange","success does not come easy", "seven swans swimming", "guess the word", "wild goose chase"]
}
я хочу добавить массив в качестве элементов списка, я попытался указать фразы вроде newListItem.textContent = (this.phrases);
, но это не сработало
addPhraseToDisplay() {
//Create a reference to ul element
const myList = document.getElementById('myList');
//Crete new list items
let newListItem = document.createElement('li');
newListItem.textContent = (this.phrases);
это HTML-код, где я бы хотел, чтобы массив был внутри элементов списка
<!--My phrases need to be appended down here, div is parent element -->
<div id="phrase" class="section">
<ul id="myList">
</ul>
, если кто-то может помочь, я был бы признателен