Declaring variables and using them in JavaScript

Javascript Variable
JavaScript variables are containers for storing data values.
JavaScript variables can hold numbers like 100, and text values like "John".
The Assignment Operator
Here, the equal sign (=) is an "assignment" operator, not an "equal to" operator.

An example which Create a variable, assign a value to it, and display it:-

<html>
<body>
<script>
<!--Using Variables-->
var carName = "Swift";
alert(carName);
</script>
</body>
</html>

Result:



Alert Showing the value of the variable carName

Description:
The Above program stores the string swift  in a variable carName  which later is displayed on a web browser through an alert

Comments

Popular posts from this blog

Non Restoring Division Algorithm Implementation in C

Bit Stuffing Code Implementation in Java

Hackerrank Modified Kaprekar Numbers Solution