Articles on Trending Technologies

Technical articles with clear explanations and examples

How to clone an object in JavaScript?

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 5K+ Views

An object is said to be an entity which has properties and types in it. Example, consider a Person as an object and it has properties like height, weight, age and salary. In the similar way JavaScript also have objects and their defined properties. An object in JavaScript is a complicated data type where it can store various data types in it. Let's consider this example below: const employee = { ...

Read More

Explain Behavior Driven Framework.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 391 Views

Behavior Driven Development (BDD) is a software development framework that brings together all project stakeholders including developers, testers, product owners, managers, customers, and business analysts. The main goal is to ensure everyone shares the same understanding of the application's requirements and behavior. BDD emphasizes collaboration and coordination among team members by describing functional requirements in plain, non-technical language that everyone can understand. This eliminates the need for deep technical coding knowledge when discussing specifications. How BDD Works The BDD process follows a structured approach that focuses on the application's behavior rather than its technical implementation: ...

Read More

Flattening multi-dimensional arrays in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 446 Views

JavaScript arrays can be nested to create multi-dimensional structures. Flattening converts these nested arrays into a single-level array. The flat() method provides a clean solution for this operation. Syntax array.flat(depth) Parameters depth (optional): The number of nested levels to flatten. Default is 1. Use Infinity to flatten all levels. Basic Example Array Flattening Demo Flattening Multi-dimensional Arrays ...

Read More

Check whether a series of operations yields a given number with JavaScript Recursion

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 185 Views

By starting from the number 1 and repeatedly either adding 5 or multiplying by 3, an infinite amount of new numbers can be produced. We are required to write a function that, given a number, tries to find a sequence of such additions and multiplications that produce that number. And returns a boolean based on the fact whether or not there exists any such sequence. For example, the number 13 could be reached by first multiplying by 3 and then adding 5 twice (1 × 3 = 3, 3 + 5 = 8, 8 + 5 = 13), so ...

Read More

Pronic numbers in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 316 Views

A Pronic number is a number which is the product of two consecutive integers, that is, a number of the form n(n + 1). For example, 6 is a Pronic number because 6 = 2 × 3, and 12 is Pronic because 12 = 3 × 4. We are required to write a JavaScript function that takes in a number and returns true if it is a Pronic number otherwise returns false. Understanding Pronic Numbers The first few Pronic numbers are: 0, 2, 6, 12, 20, 30, 42, 56, 72, 90... ...

Read More

How to set multiple cookies in JavaScript?

mkotla
mkotla
Updated on 15-Mar-2026 4K+ Views

In JavaScript, you can set multiple cookies by calling document.cookie multiple times. Each call adds a new cookie to the browser's cookie store. Unlike other properties, document.cookie doesn't overwrite existing cookies — it appends new ones. Basic Syntax for Multiple Cookies document.cookie = "cookie1=value1"; document.cookie = "cookie2=value2"; document.cookie = "cookie3=value3"; Example: Setting Multiple Cookies Here's a complete example showing how to add, list, and remove multiple cookies: var num = 1; ...

Read More

What will happen when 1 is converted to Boolean in JavaScript?

Paul Richard
Paul Richard
Updated on 15-Mar-2026 197 Views

In JavaScript, when the number 1 is converted to Boolean, it becomes true. This is because 1 is considered a "truthy" value in JavaScript's type conversion system. Understanding Truthy and Falsy Values JavaScript has specific rules for Boolean conversion. The number 1 (and all non-zero numbers) are truthy values, meaning they convert to true. Example: Converting 1 to Boolean Convert 1 to Boolean var myVal = 1; document.write("Boolean: " ...

Read More

How to add comments in the style sheet blocks

Samual Sam
Samual Sam
Updated on 15-Mar-2026 300 Views

You may need to put additional comments in your stylesheet blocks. Therefore, it is very easy to comment any part of the style sheet. You can simply put your comments inside /*...this is a comment in style sheet...*/. You can use /* ... */ to comment multi-line blocks in a similar way you do in C and C++ programming languages. Syntax /* Single-line comment */ /* Multi-line comment can span multiple lines */ Example: Adding Comments to CSS ...

Read More

Find the middle element of an array using recursion JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 529 Views

We are required to write an array function, say findMiddle that returns the middlemost element of the array without accessing its length property and without using any kind of built-in loops. If the array contains an odd number of elements, we return the one, middlemost element, or if the array contains an even number of elements, we return an array of two middlemost elements. So, let's write the code for this function. As you've already guessed, we will be making use of recursion to find these elements. The code for the recursive function will be — How It ...

Read More

Program to find uncommon elements in two arrays - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

Finding uncommon elements in two arrays means identifying elements that exist in one array but not in both. This is also known as finding the symmetric difference between two arrays. Problem Definition Given two arrays, we need to find elements that are present in either the first array or the second array, but not in both arrays. const arr1 = [12, 54, 2, 4, 6, 34, 3]; const arr2 = [54, 2, 5, 12, 4, 1, 3, 34]; console.log("Array 1:", arr1); console.log("Array 2:", arr2); Array 1: [12, 54, 2, 4, 6, 34, ...

Read More
Showing 18571–18580 of 61,297 articles
Advertisements