JavaScript to syntax – Pass Variables By Reference In JS

JavaScript syntax is the set of rule and instruction through which the JavaScript Programs are executed:

There are two types of JavaScript values:

Fixed values: The fixed values are known as Literals.

JavaScript Literal consists of numbers with or without decimals.

The strings are the text or letters written in double or single quotes.

Example:

<!DOCTYPE html>
<html>
<body>
<h2>Hello JavaScript Literals</h2>
<p>In JavaScript Literals, The Numbers can be written with or without decimals.</p>
<p id="darkweb"></p>
<script>
document.getElementById("darkweb").innerHTML = 79.56;
</script>
</body>
</html>

Variable Values: The Variable Values are also known as Variables. The variable is used to store the Values of data. In JavaScript, the (var) Keyword is used to declare a Variable, and the (=) sign is used to assign the Values to the variable.

For example, var a; is known as variable declaration, and  a=5; is known as initialization in which the value is assigned to the variable.

<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Variables</h2>
<p> a is a variable and 5 is the assigned value:</p>
<p id="darkweb"></p>
<script>
var a;
a = 5;
document.getElementById("darkweb").innerHTML = a;
</script>
</body>
</html>

Stay in touch. Ask Questions.
Lean on us for help, strategies and expertise.

Leave a Reply

Your email address will not be published. Required fields are marked *