I have an array of words stored as objects and I am looking to showcase all the properties associated with each word. While only two words are shown here, there are actually many more in the array.
const words = [
{
word:'interrogate'
meaning:'Formally question'
},
{
word:'tiresome'
meaning:'fatiguing'
}
]
I attempted to achieve this by using a for loop but unfortunately, it didn't yield any results. The code snippet below showcases my attempt:
for(var tn= 0; tn<words.length-1; tn++){
document.getElementById("result").innerHTML=words[tn].meaning;
};
Despite my efforts, nothing appeared on the screen. On a side note, "result" refers to the ID of the paragraph element where I intended to display the word meanings.