Why I'm getting [ object Object ] ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why I'm getting [ object Object ] ?

Need help to understand the attached js lines pretty please https://code.sololearn.com/c2JVv7pzgTwU/?ref=app

13th Aug 2021, 10:36 AM
Mohd Aadil
Mohd Aadil - avatar
1 Answer
+ 3
Since <obj> is an array, you can use forEach() method obj.forEach( o => console.log( `${o.name} height is ${o.height}cm` ) );
13th Aug 2021, 11:19 AM
Ipang