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

138
Views
How to safely set object keys that are passed from an outside source?

I have a usecase where I am building a js object dynamically with keys (strings) coming from outside source. How should I process the strings before using them as keys in the js object?

var strings = ["a1","2", "\@ja"]; // coming from outside source. They could be anything
var obj = {};
for(let key of strings){
    // what should do here to make sure the key string is safe to use as key
    obj[key] = "random value";
}
about 4 years ago · Santiago Gelvez
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!