JavaScript Syntax

1/21/2020 12:34:24 AM

JavaScript have some rule. When we write JavaScript code then we need to know how to write JavaScript code and how to follow JavaScript coding pattern it’s called JavaScript syntax. How to declare JavaScript variable it’s follows the syntax. “var” is a reserve keyword to store any type of value. It is auto converting the type by the right side which type of value are present. Now given bellow the JavaScript code and explain the code:

var x, y, z;         //declare variables
x = 5; y = 6;      //assign values
z = x + y;          // add values and store to z variable
var a="Reza Karim";   //string variable declare and assign value

In the code we first declare the three variables name as x,y,z. this variable assign  Integer value then add x , y and store the value into z variable. Also ‘a’ is a string variable to store the ‘text’ or ‘string’.