I have the following code
let branch_timings=locations.branch_timings;
for(let key of Object.keys(branch_timings)){
branch_timings[key].timingsEnabled=false;
}
console.log(locations);
I tried converting this to while loop like this:
let keys=locations.keys()
let i=0;
while(i<keys.length)
{
let key=keys[i];
branch_timings[key].timingsEnabled=false;
i++;
}
console.log(locations);
when I run my while loop code this is the error I get
TypeError: locations.keys is not a function
This is part of a bigger code from a question i posted earlier. Every solution I have found is in either for
loop or forEach
I am trying to learn how to convert these loops to while. I am fairly new to javascript, your opinions will be appreciated.