1050 0 0 0
Last Updated : 2025-04-28 23:37:13
In case you have an object and need to loop through all its keys or properties and its related values you can use the following syntax
const movie = {
info: {
title: "Eagle Eye",
level : 5,
type: 'action'
},
id: Math.random()
}
for(const key in movie.info) {
console.log(`${key} : ${movie.info[key]}`);
}
//The output would be :
// title : Eagle Eye
// level : 5
// type : action