+ 1
JavaScript code returns NaN, i don't know what to do
So I'm learning intermediate JavaScript course right now from Sololearner, and i came accross this problem in the "Core objects" module's code project, i cannot solve it, or rather i think maybe the problem has an issue? Please look at it it's supposed to output an array of numbers, but the array contains "NaN". https://code.sololearn.com/WPqV2W1M19Yr/?ref=app
4 Antworten
+ 4
You cannot use readLine() unless you're using a node.js compiler. Change it to prompt()
+ 2
Hey marn.
your increamenter is not from a user, so to get a value to increament elements of your list use the following line
var increase = (prompt("Enter a number increament list"))
then where you are iterating through your list just cast this input like
prices[i] = prices[i] + Number(increase);
this should solve your problem
+ 1
The problem is:
You are working on a Store Manager program, which stores the prices in an array You need to add functionality to increase the prices by the given
amount
The increase variable is taken from user input. You need to increase all the prices in the given array by that amount and output to the console the resulting array,
0
So I'm learning intermediate JavaScript course right now from Sololearner, and i came accross this problem in the "Core objects" module's code project, i cannot solve it, or rather i think maybe the problem has an issue? Please look at it it's supposed to output an array of numbers, but the array contains "NaN".