Q1.Primitive and Non-primitive data-types in JavaScript.
Primitive Data Types.
Primitive data types are the built-in data types provided by JavaScript. They represent single values and are immutable, meaning their values cannot be changed directly after creation. JavaScript supports the following primitive data types:Non-primitive Data Types
Non-primitive data types, also known as reference types, are objects and derived data types. They can store collections of values or more complex entities. The two key non-primitive data
Q2.JavaScript Number parseInt() Method.
The parseInt() method parses a value by converting it to a string and returns the first integer found. It also accepts an optional radix parameter that specifies the base of the numeral system.
Converts a string into an integer value.
Supports different number systems using the radix parameter.
Stops parsing when a non-numeric character is encountered.
Q3:JavaScript Number parseFloat() Method.
The JavaScript parseFloat() method accepts a string and converts it to a floating-point number. If the string does not contain a numerical value, or if the first character of the string is not a number, then it returns NaN, i.e., not a number. It actually returns a floating-point number parsed up to that point where it encounters a character that is not a Number.
Q4:Post-Increment (x++) || Pre-Increment (++x) && Pre-Decrement (--x) || Post-Decrement (x--).
Post-Increment (x++):
The post-increment operator evaluates the current expression using the variable's original value, and then adds 1 to the variable right after.
`let x = 5;
let y = x++; // y gets the original value (5), then x becomes 6
console.log(y); // Output: 5
console.log(x); // Output: 6
`
Pre-Increment (++x):
The pre-increment operator adds 1 to the variable first, and then returns the newly updated value to the expression
`let x = 5;
let y = ++x; // x becomes 6 first, then y gets the new value (6)
console.log(y); // Output: 6
console.log(x); // Output: 6
`
Pre-Decrement (--x):
In a prefix operation, JavaScript updates the variable instantly before evaluating the rest of the statement
`let x = 5;
// Decrements x to 4, then returns 4 to be assigned to 'result'
let result = --x;
console.log(result); // Output: 4
console.log(x); // Output: 4`
Post-Decrement (x--)
In a postfix operation, JavaScript saves the original value to use in the expression, then subtracts 1 from the variable behind the scenes
`let y = 5;
// Returns the original value (5) to 'result', then decrements y to 4
let result = y--;
console.log(result); // Output: 5 (the old value)
console.log(y); // Output: 4 (the updated value)`



Top comments (1)
Super Explanation Bro.