Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Level 9 > lesson 7

let course = {
name: "JS Course",
duration : "15 hours",
price: 499,
discount: "100%"
};
for(keys in course)
{
console.log(`${keys} is ${course[keys]}`);
}


Output -
name is JS Course
duration is 15 hours
price is 499
discount is 100%

still this code not working
by

1 Answer

sam5epi0l
You are supposed to use 'x' as iterator not "keys" as shown below:

let course = {
name: "JS Course",
duration : "15 hours",
price: 499,
discount: "100%"
};

for(x in course)
{
console.log(`${x} is ${course[x]}`);
}

Login / Signup to Answer the Question.