- All JavaScript variables must be identified with unique names.
- These unique names are called identifiers.
- Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
- In JavaScript, the equal sign (=) is an "assignment" operator.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Variable</h1>
<input type="button" onclick="cal_var();" value="Know variable">
<script>
function cal_var()
{
/*Statements are separated by semicolons.*/
var a = 55;
var b = 67;
var c = a + b;
alert(c);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Variable</h1>
<input type="button" onclick="cal_var();" value="Know variable">
<script>
function cal_var()
{
/*Statements are separated by semicolons.*/
var a = 55;
var b = 67;
var c = a + b;
alert(c);
}
</script>
</body>
</html>
What is variable :- JavaScript
Reviewed by Network security
on
June 01, 2019
Rating:
No comments: