I was trying to solve a problem where I would iterate through a dictionary, returning the corresponding values. This is my code.
var dict = {"Cost":"16","Description":"dkjfdkljskjf"};
var keys = Object.keys(dict);
console.log(keys)
for(var i = 0;i < keys.length;i++){
console.log(dict[keys[i]]);
}
When this code ran, it returned the following:
Even though it returns the values, it also returns an undefined. What returns the undefined?What does it mean?Why is it returning both?
Thanks in advance