Why does the "for in " loop say undefined when I use the dot syntax to get attributes of an object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does the "for in " loop say undefined when I use the dot syntax to get attributes of an object?

And yet it works when I use object[attribute] https://code.sololearn.com/WrKa6A35X5qz/?ref=app

21st Sep 2021, 7:59 AM
Sheldon 10110
Sheldon 10110 - avatar
2 Answers
+ 1
Ipang aah I see, thank you
24th Sep 2021, 8:30 AM
Sheldon 10110
Sheldon 10110 - avatar
0
Line 10 for ( let val in dude1 ) { console.log( val ); } Here <val> represents each attribute name (not value) in <dude1>.
21st Sep 2021, 8:42 AM
Ipang