0

Javascript Array [Solved]

I have two questions regarding the sum of values in an array in javascript. 1) How could each value be added so that the result is an array and not a string. For example I attach my code. The result should be: ["107.99", "24.2", "29", "1035"] My result is: 107.9924.2291035 2) In comments is the value entered by keyboard, how to control that. Maybe you just make the call to the variable. Please help. I need this to finish the javascript course https://code.sololearn.com/Wa1860A0A251/?ref=app

8th Dec 2020, 6:34 PM
David Romero Vaca
David Romero Vaca - avatar
6 Answers
8th Dec 2020, 6:48 PM
Pratyush Raj[LEFT]-TEMP
Pratyush Raj[LEFT]-TEMP - avatar
+ 2
David Romero Vaca , uncomment the increase variable read as input. Remove the second increase variable which you assign 9. You need to change every value of the array with the increase variable and log the changed array - don't output a single value. As a hint you can use map method to do it.
8th Dec 2020, 6:51 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 2
David Romero Vaca , I don't think that projects are restricted to specific knowledge. You can achieve the result in many ways. For example other way than using map method is, you can create your function with two parameters - the array and the value. Then perform the necessary operations.
8th Dec 2020, 7:08 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
The only thing I did was enter each value of the array inside a for, in which the maximum size of the array shown by length is the maximum limit.
9th Dec 2020, 7:04 AM
David Romero Vaca
David Romero Vaca - avatar
0
Ty I aprreciate it very much, now I just need transform the values to enter them into an array.
8th Dec 2020, 6:51 PM
David Romero Vaca
David Romero Vaca - avatar
0
Yep white cat, but the lesson its before of map methods. By the way Pratyush Raj, you Help me with input value, but it is not increasing the value... It is Only adding the other value at the beginning (it is concatenating but not adding) :'(
8th Dec 2020, 6:57 PM
David Romero Vaca
David Romero Vaca - avatar