+ 4

What is this error?

I have created a code ,which works fine in other editors but sololearn is showing error and not executing it. The error is in javascript section. https://code.sololearn.com/Waqn3JfUZ1Ws/?ref=app

7th Apr 2020, 9:58 AM
OfcourseitsRohit
OfcourseitsRohit - avatar
4 Antworten
+ 5
visph thanks you 😊it is fixed now
7th Apr 2020, 10:57 AM
OfcourseitsRohit
OfcourseitsRohit - avatar
+ 6
Call typing() function inside document.ready or document.onload. You can also call your function on body tag inside onload event like this: <body onload = "typing()">
7th Apr 2020, 10:08 AM
A͢J
A͢J - avatar
+ 6
replace the last line of your code by: onload = typing; (assign the function, not the function call: don't keep the parenthesis pair) The problem was that the js tab in code playground (same for css tab) is included in the head section of the html tab, so is executed before any page content was accessible, so you must wait for it to be loaded: onload is the document onload event handler, attached to the global window object (document.onload == window.onload)...
7th Apr 2020, 10:11 AM
visph
visph - avatar
+ 5
visph thanks you 😊it is fixed now
7th Apr 2020, 10:56 AM
OfcourseitsRohit
OfcourseitsRohit - avatar