I am trying to loop through the following:
{
\"messages\": [{
\"msgFrom\": \"13223821242\",
\"msgBody\": \"Hi there\"
}, {
\"
Iterations
Method 1: forEach method
messages.forEach(function(message) {
console.log(message);
}
Method 2: for..of method
for(let message of messages){
console.log(message);
}
Note: This method might not work with objects, such as:
let obj = { a: 'foo', b: { c: 'bar', d: 'daz' }, e: 'qux' }
Method 2: for..in method
for(let key in messages){
console.log(messages[key]);
}