skip to Main Content

New to JS and I feel extremely stupid as the linked js file is not working when I load my index.html file

You can see I have <script> src = "funn.js </script>

enter image description here

and my js file is simply let js = 'test'; if (js === 'test') alert ('test');

But when I reload the page or show the interactive preview from webstorm, I see nothing

2

Answers


  1. src is an attribute of the <script> tag. It should be:

    <script src="funn.js"></script>
    

    What’s written between the brackets is actual JavaScript code.

    Login or Signup to reply.
  2. use src before closure the tag <script>

    <script src="funn.js"></script>
    

    In the corresponding questions, do not send the photos, write the code

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search