0

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.

cdis
  • 1

0 Answers0