0
where should I write JS code?
Here while checking the example codes of the JS course I saw that tjere is four tabs (html, css, js, result). But in the examples that I checked non had declared script tag in html file. Does Sololearn do it automatically cause I thought we have to write a .js file in the same directory of the html file and declare it in html. I'm just starting out thus I don't know what is going on here.
5 Respostas
+ 4
Yes! Sololearn include it if you write your code in script tag or Javascript section.
Sample Code : https://code.sololearn.com/WYW6eHPjA4kl/?ref=app
In your computer system if you are trying it then also connect your js file with html using script tags src attribute.
+ 2
First js section will execute not the tag one here! Please try to edit my code and clear your doubts!
0
Thanks for your answer. It clarified the situation but made some more. In your example there are two scripts, One outputting to consule one to document. Which would run first? And considering writing to document appends content on top of the page can we assume javascript is running befor html? (If it's even a valid question to ask because html is not runnig) Or is it just Javascripts default to add content above previous ones?
0
https://code.sololearn.com/WaGa2vb34TZQ/?ref=app
Yes I see now. I wonder why it didn't come to my mind to actually try it!😆
0
You should have to try dcoder app
In which you can create projects also
Sololearn does not provide that much facility