CHAPTERFOUR
Be focused and you will archive alot. choose your ON javascript
Explore moreBe focused and you will archive alot. choose your ON javascript
Explore moreLorem ipsum dolor sit amet consectetur adipisicing elit. Hic odit rem dolorum molestiae fugit deserunt exercitationem recusandae, itaque ratione harum sit repellat dolor temporibus deleniti non voluptatem nostrum quas? Cumque veniam, molestias id natus pariatur dolores aut nemo iure facilis expedita, temporibus exercitationem ullam ex officiis reiciendis quaerat enim consequuntur.
they give the identity of the daata been stored
(immutable, stored by value)
(mutable, stored by reference)
Primitive Data Types (immutable, stored by value)
Reference Data Types (mutable, stored by reference)
1. String – Text values
2. Number – Integers & decimals
3. Boolean – true or false
4. Undefined – Variable declared but not assigned
5. Null – Empty or unknown value
6. BigInt – Large integers
7. Symbol – Unique identifiers
Example:
let firstName = "John"; // String
let age = 30; // Number
let isStudent = true; // Boolean
let address; // Undefined
let salary = null; // Null
Reference Data Types
1. Arrays – Lists of data
2. Objects – Key-value pairs
3. Functions – Blocks of reusable code
Example:
let colors = ["Red", "Green", "Blue"]; // Array
let person = { name: "John", age: 30 }; // Object
4. Comparison Operators
Comparison operators are used to compare two values.
let a = 10;
let b = "10";
console.log(a == b); // true (checks only value, not type)
console.log(a === b); // false (checks both value and type)
console.log(a != b); // false (not equal by value)
console.log(a !== b); // true (not equal by value and type)
console.log(a > 5); // true
console.log(a < 20); // true
console.log(a >= 10); // true
console.log(a <= 5); // false
== checks value only.
=== checks value and type (strict comparison).
!= checks if values are not equal.
!== checks if values and types are not equal.
5. Logical Operators
Logical operators combine multiple conditions.
let x = 5;
let y = 10;
console.log(x > 0 && y > 0); // true (AND → both conditions must be true)
console.log(x > 0 || y < 0); // true (OR → at least one condition must be true)
console.log(!(x > 0)); // false (NOT → reverses condition)
&& (AND) → True if both conditions are true.
|| (OR) → True if at least one condition is true.
! (NOT) → Reverses the result.
6. Ternary Operator
The ternary operator is a shortcut for if-else statements.
let age = 18;
let status = age >= 18 ? "Adult" : "Minor";
console.log(status); // Output: "Adult"
It works as:
condition ? value_if_true : value_if_false;
<!DOCTYPE html> <html> <head> <title>Title of the Page</title> </head> <body> <h1>ternary operator</h1> <p id="output"></p> <script> let age = 18; let status = age >= 18 ? "Adult" : "Minor"; document.getElementById("output").innerHTML = status; </script> </body> </html>
Title of the Page
ternary operator
vildash network team has had alot of impact on others but here are the vildash network team testimonies and expirience while working with the team
you can now connect and text other users from our database. you just neeed to click bellow to message them
WE HAVE CODE EDITORS FOR LANGUAGES LIKE C, C#, C++, HTML, CSS, javascript, JAVA VISUAL BASIC
We dont just teach you to code we teach you to code and build amazing systems.we are group of expert who wants to promote our field of studies