+ 2
Please help me in JavaScript there is no error showing in JavaScript console please help me
2 Respostas
+ 1
There are two issues hindering your code.
First, (HTML tab), you need to invoke createSquare(), with your code as-is you can do this by placing createSquare() between the script tags in HTML.
Last, (js tab), innerheight() and innerwidth() should be innerHeight and innerWidth. Keep in mind that these are simple properties of the Window object, not methods, also camelcase is used as part of the naming convention.
https://code.sololearn.com/WUC1nNOWXT3b/?ref=app
[edit] the code above will only work on sololearn website.
+ 1
I have to apologize for my first reply, it is somewhat misleading. I suggested placing createSquare() between the script tags, while this will work on the Sololearn website it will not work when using iOS or Android apps.
You can either use the onload event in HTML or javascript to invoke createSquare() after the document is loaded this will work all on platforms/modalities.
https://code.sololearn.com/WWjfnSqOjPEV/#html
https://code.sololearn.com/WtO7SotjL4Zl/#html