+ 1
Array Properties & Method exercice. Confused.
Hello. I was just doing the program exercice on the Array Properties and Method. I made the program work with a different code than the solution. But confused to the result, I decided to make some test. Picture : https://ibb.co/wMKqM4G Instead of adding each of the input like the exercice asked, i've made a console.log of each string in the array. Seeing the input in test case 1 , logically it should be Points[0] = 3 Points[1] = 1 Points[2] = 4 Points[3] = 8 But given by the output, it's actually. Points[0] = 1 Points[1] = 4 Points[2] = 8 Points[3] = 0 (which shouldn't even exist Am very confused. Am I missing something i'm not seeing ? Thanks for the help.
2 odpowiedzi
+ 2
Where is the code?
Link not working... pls share the code
+ 1
Put the code in the for block.
sum += points[i];
// console.log(points[i]);
// ++i;