Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
javascript map(val , index) , which condition val is variable and string

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)
})

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!