0
Why my code isn't displaying the results.
Anyone please help me. https://code.sololearn.com/WZkPnnkTDqbH/?ref=app
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...
+ 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
0
Thank you
0
Thank you