Let's dive into variables, data types, and operators in JavaScript!
Variables : In JavaScript, you can declare variables using var
, let
, or const
.
Data Types : 2 type ( Primitive Data Types & Complex Data Types)
Operators : 4 type ( Arithmetic Operators, Comparison Operators, Logical Operators, Assignment Operators)
//Variables
var name = "John"; // Declaring a variable with var
let age = 30; // Declaring a variable with let
const pi = 3.14; // Declaring a constant with const
// Data Type
//Primitive Data Types
Number: Represents both integers and floating-point numbers.
String: Represents a sequence of characters.
Boolean: Represents true or false.
Undefined: Represents a variable that has been declared but not assigned a value.
Null: Represents a null value or "nothing".
BigInt: Represents large integers.
Symbol: Represents unique values.
//Complex Data Types
Object: Represents collections of key-value pairs.
Array: Represents a list-like object.
//Arithmetic Operators
+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
% (Modulus)
++ (Increment)
-- (Decrement)
//Comparison Operators
== (Equality)
=== (Strict Equality)
!= (Inequality)
!== (Strict Inequality)
> (Greater Than)
< (Less Than)
>= (Greater Than or Equal To)
<= (Less Than or Equal To)
//Logical Operators
&& (Logical AND)
|| (Logical OR)
! (Logical NOT)
//Assignment Operators
= (Assignment)
+= (Add and Assign)
-= (Subtract and Assign)
*= (Multiply and Assign)
/= (Divide and Assign)
© www.thecoderjob.com. All Rights Reserved. Designed by HTML Codex