Hello everybody I have a short question about iteration in objects
Here's my code [https://jsfiddle.net/Ar2zee/9g91ouq6/]
var names = {
first: 'Sasha',
second: 'Andrey',
third: 'Pasha',
lastnames: {
firstL: 'Oga',
secondL: 'opa',
thirdL: 'uka'
},
}
for (var keys in names) {
for (var newKeys in names.lastnames) {
console.log(names.lastnames[newKeys]);
}
}
My goal it's to log once all of the lastNAmes oga, opa, uka, right now my results is 4 times each of the last name can you please explain why it's 4 times right now and how to make once each of them
Thank you