After few research and test I'm still confuse about the map expression map((k,i) => { ... } )
Why my k
is a string instead of variable when i create an object { k : arr[i] }
exemple 1
let name = 'test.val2'
let test = ['name','ext'].map((k,i) => console.log({k :name.split('.')[i]}))
exemple 2
let name = 'test.val2'
let test = ['name','ext'].map((k,i) => console.log(k ,name.split('.')[i]))
exemple 3
let name = 'test.val2'
let test = ['name','ext'].map((k,i) => {
let obj = {}
obj[k] = name.split('.')[i]
console.log(obj)
})