Step 1: Create a new folder on your windows desktop called “Exercise-05”.
Step 2: Create a new text file inside the “Exercise-05” folder and save it as main.txt.
var carnumber = 2340;
var num = 10;
var n = 10;
var i = 0;document.write("This is a car and it's Model is" + " " + carname + "");document.write("The car number is " + " " + carnumber + "");
document.write("\n");var txt1 = "What a very";
var txt2 = "nice day";
var txt3 = txt1 + " " + " " + txt2;document.write(txt3 + "
for (i = 0; i < n; i++)
num = num * 4;
document.write("Number=" + num);
Step 4: Save the file as main.js in “Exercise-05” folder and close it.
The variable names, carname, txt1, txt2 and txt3 are decided using the keyword “var” and assigned a string value “Hyundai”. It automatically becomes a variable of type String.
Similarly, the variable carnumber, num and i are declared using keyword “var” and assigned an integer value, so they automatically become variables of type integer.
Create an HTML Page
Output to Browser
You will see the following output in the browser.