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

157
Views
How to insert a variable name into a variable?

costOfApples1 = 2
costOfApples2 = 5
costOfApples3 = 9
var howManyApples= prompt("How many packets of apples do you want?")
var costOfApples = 

I want to determine the costOfApple variable using the howManyApples value. For example, I want the costOfApple to be equal to costOfApple1 if the howManyApples value is 1.

var costOfApples = 'costOfApples' + howManyApples

This doesn't work, obviously, but I added it to show where I'm going at.

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!