JavaScript Data Types
JavaScript provides different datatypes to hold different values on variables. JavaScript is a dynamic programming language, which means do not need to specify the type of variable. There are two types of data types in JavaScript.
- Primitive data type
- Non-primitive (reference) data type
// It store string data type
let txt = "w3wiki";
// It store integer data type
let a = 5;
let b = 5;
// It store Boolean data type
(a == b )
// To check Strictly (i.e. Whether the datatypes
// of both variables are same) === is used
(a === b)---> returns true to the console
// It store array data type
let places= ["GFG", "Computer", "Hello"];
// It store object data (objects are
// represented in the below way mainly)
let Student = {
firstName: "Johnny",
lastName: "Diaz",
age: 35,
mark: "blueEYE"
}
JavaScript Syntax
JavaScript syntax refers to the rules and conventions dictating how code is structured and arranged within the JavaScript programming language. This includes statements, expressions, variables, functions, operators, and control flow constructs.
Syntax
console.log("Basic Print method in JavaScript");
JavaScript syntax refers to the set of rules that determines how JavaScript programs are constructed:
// Variable declaration
let c, d, e;
// Assign value to the variable
c = 5;
// Computer value of variables
d = c;
e = c / d;
JavaScript Values
There are two types of values defined in JavaScript Syntax:
- Fixed Values: These are known as the literals.
- Variable values: These are called variables
These are the features of JavaScript which have some predefined syntax:
Table of Content
- JavaScript Literals
- JavaScript Variables
- JavaScript Operators
- JavaScript Expressions
- JavaScript Keywords
- JavaScript Comments
- JavaScript Data Types
- JavaScript Functions
- JavaScript Identifiers