HOW TO CREATE VARIABLE IN JAVASCRIPT
HOW TO CREATE VARIABLE IN JAVASCRIPT:-
in java script variable is to be created using 'var' keyword
syntax:-
note:- variable can not used "" inverted couma.
VAR NAME;
ex.:-
var city;
var college;
var country;
var a=10;
document.write(a);
var city="Nagpur";
document.write(city);
HOW TO DISPLAY VARIABLE DATA WITH MASSAGE:-
result is
the value of a-10
note :- in java script using variable with massage (+) operator)
var a=10;
document.write("the value of a" + a);
HOW TO INPUT DATA FROM THE USER USING PROMPT STATMENT:-
var a;
a=prompt("enter any number");
document.write(1);
HOW TO DISPLAY VARIABLE VALUE INSIDE THE TAG:-
var a;
a=prompt("enter any number");
document.write("<h1>" + a +"</h1>");
Comments
Post a Comment