Why my code isn't displaying the results. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my code isn't displaying the results.

Anyone please help me. https://code.sololearn.com/WZkPnnkTDqbH/?ref=app

6th Aug 2019, 4:48 AM
Yasir Mohammed
Yasir Mohammed - avatar
4 Answers
+ 2
Well first of all you spelt javascript wrong, but you can delete that whole part. I believe the issue is your script isnt being executed, you can slap that sucker in a window onload function and it should work window.onload = function() { const range=[2,4,5,6,7,8,4,3,5,3,5,3]; var sum = 0; for(x=0; x<range.length;x++) { sum+= range[x]; } console.log(sum); }; or you can just put your code in the designated javascript tab...
6th Aug 2019, 5:08 AM
Jake
Jake - avatar
+ 2
From what is seems, including language = "javascript" within the script tag seems to be messing it up, so removing that allows it to function correctly
6th Aug 2019, 5:09 AM
Faisal
Faisal - avatar
0
Thank you
6th Aug 2019, 5:10 AM
Yasir Mohammed
Yasir Mohammed - avatar
0
Thank you
6th Aug 2019, 5:10 AM
Yasir Mohammed
Yasir Mohammed - avatar