+ 1

How to increase, Please, read below.

How to increase all items in Array by variable. for eaxample, var increase = 4; var array = [12, 34, 10, 19]; if we solve the problem to it, it will output: [16, 38, 14, 23] please, Could you try to solve the problem.

29th Mar 2021, 2:48 PM
0diljon Abduqaxxarov
0diljon Abduqaxxarov - avatar
4 Antworten
+ 2
//Use for loop var increase = 4; var array = [12, 34, 10, 19]; For(i=0i<array.length;i++){ array[i]+=4 } Console.log(array) //You will get your expected output
29th Mar 2021, 3:24 PM
Tarun Gautam
Tarun Gautam - avatar
+ 4
Show your code
29th Mar 2021, 2:51 PM
Papa Penguin
0
Ok it's very simple use a for loop and add 4 and reassign them to their original position Ex : array[0] += 4
29th Mar 2021, 3:02 PM
Ayush Kumar
Ayush Kumar - avatar
0
Nice
31st Mar 2021, 6:29 AM
Bilash Kabiraj
Bilash Kabiraj - avatar