You will learn all the basics of using the computer and the internet as you work through many different coding challenges.
It is a computer programming language, we use it to modify the website content. It can calculate, validate and manipulate the data.
Save this “filename.html” for example “myjsfile.html” you can use any file name but add “.html” after the file name.
Comments are not visible on the output screen. Web developer types the comments for understanding the codes types and uses.
For single-line comment
// your comment
For multi-line comment
\* Multi-line comments
This is Lunar Computer College *\
In Google Chrome Click on the top right corner of Chrome under the close icon.
Then click on Settings On the next page scroll down to last and click on Advanced now under the Privacy and security click on Content settings.
Open firefox type about:config in the address bar of Firefox and press Enter.
The variable contains alphabets, numbers, dollar sign ($) and undersore (_) .
The variable name must be started from the alphabets.
$ and _ can be used at the start of a variable
var x = 9
x is a variable and 9 is the value.
Adding numeric values using variables
var x = 5
var y = 10
var z = x+y
Save this with a .html extension like addme.html and open it on the web browser.
We can add subtract multiply and divide the numeric values the same as we add the numeric values in the upper example.
10 + 5 = 15
10 – 5 = 5
10 * 5 = 50
10 / 5 = 2
you need to use a document.write(“</br>”); tag to get the output in different lines otherwise your output will be like this
10 + 5 = 1510 – 5 = 510 * 5 = 5010 / 5 = 2
var n$ = prompt (“your message on screen for string values”);
var n = prompt (“your message on screen for numeric values”);
for (var n =1;n<=10;n++)
for (var k =1;k<=10;k++)