Pls what is wrong? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Pls what is wrong?

This is to remove all occurences of 1 https://code.sololearn.com/WV03Cu2CQ8Iw/?ref=app

15th Feb 2019, 10:26 AM
Tolulope Ayodele
3 Réponses
+ 2
In your code, in the first iteration, the splice method performs operation of removing 1 from the array and returning the spliced element so the function ended. So the function return is only one 1 Here is what splice do: https://code.sololearn.com/W3cNMx37R657/?ref=app Here is a solution for you: https://code.sololearn.com/WOpSE8iFo1e3/?ref=app
15th Feb 2019, 10:40 AM
Gordon
Gordon - avatar
+ 1
Yes my solution for you is removing only the 1's
15th Feb 2019, 1:19 PM
Gordon
Gordon - avatar
0
The code removed some other numbers from the array. I'd like to remove only the 1's
15th Feb 2019, 10:52 AM
Tolulope Ayodele