editor
let obj = {
username0: ‘Santa’,
username1: ‘Rudolf’,
username2: ‘Mr.Grinch’
}
Object.keys(obj).forEach((key, index) => {
console.log(key, obj[key]);
})
Object.values(obj).forEach(value => {
console.log(value);
})
Object.entries(obj).forEach(value => {
console.log(value);
})
Object.entries(obj).map(value=> {
return value[1] + value[0].replace(‘username’, ‘’);
})
Why doesn’t the last one
Object.entries(obj).map(value=> {
return value[1] + value[0].replace(‘username’, ‘’);
})
show the result on Console? But it only shows the last one when you have to copy it and enter on Console.
The last one is not logging anything to the console
Is there a reason for it? There is return just like the above three Object..
Because you never log
Обсуждают сегодня