JavaScript- Not Getting Variable Output

I’m not getting the variable output in the JavaScript example shown in the lectures of Bolt IoT and ML training.

I have followed the steps written there but not getting the variable output as “Bolt IoT”

This is because you must not be changing the src attribute of script in html code…
like this…

HTML code

<html>
    <title>Javascript Variables</title>
    <body>
        <h2>JavaScript Variables</h2>
        <p>Create a variable, assign a value to it, and display it:</p>
        <p id="demo"></p>
        <script src="new 1.js"></script>
    </body>
</html>

JAVASCRIPT code

var myVariable = “Bolt IoT”;

  document.getElementById("demo").innerHTML = myVariable;

So you can observe that src value is new 1.js because i have saved my javascript code with new 1.js

Hope it helps…!! :grinning:
Please inform me also…!!

This problem was also faced by me.But this problem can be solve.follow the steps:-
1.Open Notepad,write the javascript code on it,save the file in .js extension
2.Again open Notepad,write the html code where you have to use src to give the file name with .js extension in the html code,save the html file in .html extension
3.find the location where your file got saved,right click on the browser page,click on inspect,click on console,you will get the value of the variables.
Hope it helps you…!!
:smiling_face_with_three_hearts:2019-07-07T18:30:00Z

1 Like

the same problem was faced by me the above procedure which described by [sumedhabanerjee2] is rigth and the correct one any one who have doubt refer that…

I am also facing the same problem !!!
Please can you explain it step 2 , i am unable to understand properly.