Articles on Trending Technologies

Technical articles with clear explanations and examples

What is Unary Negation Operator (-) in JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 560 Views

The Unary Negation Operator (-) converts its operand to a number and then negates it. It operates on a single operand and returns the negative value. Boolean values are converted to 0 or 1 before negation, and numbers in different bases are converted to decimal first. Syntax -operand The unary negation operator (-) precedes the operand to negate its value. Basic Examples Let's see how the unary negation operator works with different data types: ...

Read More

What is if...else if... statement in JavaScript?

Krantik Chavan
Krantik Chavan
Updated on 15-Mar-2026 488 Views

The if...else if... statement allows JavaScript to evaluate multiple conditions sequentially and execute the first matching condition's code block. Syntax The syntax of an if...else if statement is as follows: if (condition1) { // Code to execute if condition1 is true } else if (condition2) { // Code to execute if condition2 is true } else if (condition3) { // Code to execute if condition3 is true } else { // Code to execute if no condition is true } How It ...

Read More

What is Bitwise XOR Assignment Operator (^=) in JavaScript?

Abhinaya
Abhinaya
Updated on 15-Mar-2026 369 Views

The Bitwise XOR Assignment Operator (^=) performs an XOR (exclusive OR) operation between the left and right operands, then assigns the result back to the left operand. It's a shorthand for a = a ^ b. Syntax variable ^= value; // Equivalent to: variable = variable ^ value; How XOR Works XOR returns 1 when bits are different, 0 when they're the same: let a = 2; // Binary: 10 let b = 3; // Binary: 11 console.log("Before: a =", a, "b =", b); a ^= b; ...

Read More

What is the "double tilde" (~~) operator in JavaScript?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 3K+ Views

The "double tilde" (~~) operator is a double NOT bitwise operator in JavaScript. It converts a number to a 32-bit signed integer and truncates any decimal part, making it a faster alternative to Math.floor() for positive numbers. How It Works The tilde (~) operator performs bitwise NOT operation. When used twice (~~), it effectively converts a value to an integer by: Converting the value to a 32-bit signed integer Truncating decimal places (not rounding) Returning the integer result Example: Basic Usage ...

Read More

What is Addition Operator (+) in JavaScript?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 345 Views

The addition operator (+) in JavaScript is used to add two numeric operands together. It performs mathematical addition and returns the sum of the values. Syntax result = operand1 + operand2; Example You can try to run the following code to work with the addition operator: var a = 33; var b = 10; ...

Read More

What is Addition Assignment Operator (+=) in JavaScript?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 310 Views

The Addition Assignment Operator (+=) adds the right operand to the left operand and assigns the result back to the left operand. It's a shorthand way of writing a = a + b. Syntax variable += value; // Equivalent to: variable = variable + value; Example with Numbers Here's how the addition assignment operator works with numeric values: var a = 33; ...

Read More

What is Modulus Operator (%) in JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 1K+ Views

The modulus operator (%) in JavaScript returns the remainder after dividing one number by another. It's also called the remainder operator and is commonly used in programming for tasks like checking if a number is even or odd. Syntax operand1 % operand2 Where operand1 is the dividend and operand2 is the divisor. The operation returns the remainder of the division. Basic Examples console.log(10 % 3); // 1 (10 ÷ 3 = 3 remainder 1) console.log(15 % 4); // 3 (15 ÷ 4 = 3 remainder 3) console.log(20 % 5); ...

Read More

How to redirect website after certain amount of time without JavaScript?

Anvi Jain
Anvi Jain
Updated on 15-Mar-2026 6K+ Views

To redirect from an HTML page without JavaScript, use the META tag with the http-equiv="refresh" attribute. This provides an HTTP header that tells the browser to automatically redirect after a specified number of seconds. Through this method, you can automatically redirect your visitors to a new homepage or any other page. Set the content attribute to 0 if you want the redirect to happen immediately. Syntax Parameters The content attribute contains two parts separated by a semicolon: seconds - Number of seconds to wait before redirecting url - The destination ...

Read More

How to use JavaScript to redirect a webpage after 5 seconds?

Abhishek
Abhishek
Updated on 15-Mar-2026 43K+ Views

In this tutorial, we learn to use JavaScript to redirect a webpage after 5 seconds. To redirect a webpage after a delay, we use the setTimeout() method combined with window.location.href to set the destination URL. JavaScript provides two timing methods for delayed execution: setTimeout() for single execution and setInterval() for repeated execution. For page redirection, setTimeout() is the preferred method. To redirect a page we use the window.location.href property to change the current page URL: window.location.href = "https://example.com"; Using setTimeout() Method (Recommended) The setTimeout() method executes a function once after a specified delay. ...

Read More

What is unsigned Right Shift Operator (>>>) in JavaScript?

Nancy Den
Nancy Den
Updated on 15-Mar-2026 619 Views

The unsigned right shift operator (>>>) shifts the binary representation of a number to the right by a specified number of positions, filling the leftmost bits with zeros regardless of the original sign bit. Syntax result = number >>> positions How It Works Unlike the signed right shift (>>) which preserves the sign bit, the unsigned right shift always fills with zeros from the left. This treats the number as an unsigned 32-bit integer. Example with Positive Number var a = 14; var b = 2; // Shift ...

Read More
Showing 19061–19070 of 61,297 articles
Advertisements