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

145
Views
How to add a property to one element of an array?

I want to add a property to a singular element of an array.

Basically, I want to choose a singular element at random, make it appear on screen, then after it disappears add a "already chosen" property to that element so that it can't be randomly picked again.

Alternatively, if anyone knows how to temporarily exclude a single element from an array, that would be extremely helpful too.

const numbers =["1","2","3","4","5"]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use array of object this way

let values = [
  {
    "value": "1",
    "picked": "false",
  },
  {
    "value": "2",
    "picked": "false",
  }
  ,
  {
    "value": "3",
    "picked": "false",
  }
  ,
  {
    "value": "4",
    "picked": "false",
  }
  ,
  {
    "value": "5",
    "picked": "false",
  }
]

and every time that you pick a number give the true value to picked property

about 4 years ago · Juan Pablo Isaza Report
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!