I include the Js file in an html document,but I can’t view the output. I have open the document file in Mozilla fire fox this web browser shows file Not found.But I include all the document files in same folder the web browser also show file not found.further what I can do? Please give me the suggestion.thank you.
Please attach a snippet of your code. Also, did you try other browsers like Chrome?
My js code is given below:
var c = 3 + 4; // Addition operation on numbers.
console.log ("The value of c is ", c);
var x = 2;
var y = 3;
var z = x - y; // Subtraction operation on variables.
console.log ("The value of z is ", z);
var m = x * y; // Multiplication operation on variables.
console.log ("The value of m is ", m);
var n = x / y; // Division operation on variables.
console.log ("The value of n is ", n);
var w = (x * y + 20) - 10 // Arithmetic operation on an expression.
console.log ("The value of w is ", w);
And my html code :
Javascript Variables
You need to add an id(placeholder) in the html document which can be identified and replaced by the JS script.
Check the course content here
@kmuthukumarece1998 Open the console in the browser and it will be shown over there. You can google how to open the console for your particular browser.
Also, please remove the < title > tag in the JS code.
@kmuthukumarece1998, I was just drawing an analogy with general programming languages. Not sure if that is relevant to JS or not.
What it does is find the id mentioned in a HTML code, if it matches, the JS object is added to that portion of the code(Not really added, it just appears so in the browser).
@shoeb.ahmed I remove the title tag in js code,and I run the html code in web browser and I click console it shows below
I refresh again the web browser shown in same and I open in another browser it shows in below please tell what can I do? Any changes in my code please tellas per what i could understand from the photos, you have set the filename of your js code as “my javascript.js.js”.
remove the extra “.js” from the name.