I am having trouble appending an array called phrases to a method called addPhraseToDisplay(). Here is the array:
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"]
}
what I want to do is append the array into as list items, I tried to target the phrases like this newListItem.textContent = (this.phrases);
, but that didn't work
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);
this is html code where I would like the array to be inside as list items
<!--My phrases need to be appended down here, div is parent element -->
<div id="phrase" class="section">
<ul id="myList">
</ul>
if someone could help I would appreciated