Loading Please Wait...
JavaScript syntax is the set of rules that described how JavaScript program shuould be written.
In HTML, JavaScript programs are executed by the web browser.
JavaScript defines two types of values that is fixed value called literals and variable value called variables.
/* Literals */
10
10.5
"Lynxsia IT Solutions"
'Lynxsia IT Solutions'
In a programming language, variables are used to store data values.
JavaScript uses the keywords var, let and const to declare variables.
An equal sign is used to assign values to variables.
let x;
x = 6;
JavaScript uses arithmetic operators ( + - * / ) to compute values.
JavaScript uses an assignment operator ( = ) to assign values to variables.
x = (5 * 12) / 100;
An expression is a combination of values, variables, and operators, which computes to a value. The computation is called an evaluation.
x = (5 * 12) / 100;
x = (a * a) + (b * b) + (2 * a * b);
firstName = "Lynxsia";
lastName = "IT Solutions";
fullName = firstName + " " + lastName;
JavaScript keywords are used to identify actions to be performed.
let x = 10;
function welcome(){
alert('Hello');
}
Not all JavaScript statements are "executed". Code after double slashes // or between /* and */ is treated as a comment. Comments are ignored, and will not be executed:
let x = 5; // I will be executed
// x = 6; I will NOT be executed
Identifiers are JavaScript names.
Identifiers are used to name variables and keywords, and functions.
Identifiers are used to name variables and keywords, and functions.
The rules for legal names are the same in most programming languages.
A JavaScript name must begin with:
Subsequent characters may be letters, digits, underscores, or dollar signs.
Numbers are not allowed as the first character in names.
All JavaScript identifiers are case sensitive.
The variables lastName and lastname, are two different variables:
JavaScript does not interpret LET or Let as the keyword let.
Historically, programmers have used different ways of joining multiple words into one variable name.
Hyphens:
first-name, last-name, master-card, inter-city.
Hyphens are not allowed in JavaScript. They are reserved for subtractions.
Underscore:
first_name, last_name, master_card, inter_city.
Upper Camel Case (Pascal Case):
FirstName, LastName, MasterCard, InterCity.
Lower Camel Case:
firstName, lastName, masterCard, interCity.
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved