Answer the question
In order to leave comments, you need to log in
Why does the map() method return the length of an array?
Why is the map() method returning the length of the array in this code? Logically, after all, the object should be pushed
const arr = [
{testKey: 'test-value'},
{testKey1: 'test-value1'},
{testKey2: 'test-value2'},
{testKey3: 'test-value3'},
]
let newArr = arr.map((keyValue)=>{
return keyValue
}).push({newTestKey: 'new-test-value'})
console.log(newArr) // возвращает 5
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question