Varibles in javascript given program not working

the added screen shot shows the given error and the code written by me

Make sure you have created js file with “my-javascript.js” otherwise change the name of src in the html file with the one you have created.

Place the .js file in the same folder where html file is present .Check the file name whether it is same as my-javascript.js or not.

1.If not working then right click on the .js file go to the properties.
2.You can see the “Location:” below copy the entire address of the .js file and place it in the
src: in the html file.:slightly_smiling_face:

1 Like

Add <Meta> tag with charset attribute in <head>.
<meta charset=“UTF-8”>

Maybe you didn’t create the my-javascript.js file? Or you might have created it but you didn’t place it in the same folder that contains the given HTML file?

If you are still facing issues, why don’t you try inline javascript? Instead of placing the javascript code in an external file you can also place it within the tags.

Syntax for inline JS

Thank You all for your suggestions