Javascript Articles

Page 16 of 534

Which Fields Have More Demand Now, Java or JavaScript?

Mr. Satyabrata
Mr. Satyabrata
Updated on 15-Mar-2026 2K+ Views

Java and JavaScript are two programming languages that are often compared due to their similar names. However, they are fundamentally different languages, with their own unique strengths and applications in today's technology landscape. Java is a mature language that has been around for over two decades and is widely used for enterprise-level software development. It is known for its stability, security, and cross-platform compatibility. Java's static type checking system makes it a safer option for larger software projects. On the other hand, JavaScript is a dynamic language that is primarily used for front-end web development. It enables developers ...

Read More

How to use a variable for a key in a JavaScript object literal?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 12K+ Views

In JavaScript, you can use variables as object keys using bracket notation or computed property names. This is useful when working with dynamic data, API responses, or when key names are determined at runtime. Using Bracket Notation (After Object Creation) The most common approach is to create the object first, then add properties using bracket notation: Using variables as key of JavaScript object let content = document.getElementById("content"); ...

Read More

How to add bootstrap toggle-switch using JavaScript?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

The Bootstrap library provides a number of features to the user to make their coding experience smooth. One of such features which the user can choose from is the toggle-switch. The toggle-switch, one of its useful features, provides users the ability to add components which can switch between two states such as on and off. Bootstrap Toggle-switch The Cascading Style Sheets (CSS) framework Bootstrap is a toolkit that makes it simpler and more standards-compliant to create websites. It can be used, alongside JavaScript, to create a responsive user interface. The simple Bootstrap toggle-switch component is used to select ...

Read More

Javascript Program for Range Queries for Frequencies of array elements

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 260 Views

We are given an array that will contain integers and another array will be given that will contain the queries and each query represents the range that we are given by the leftmost and the rightmost index in the array and an element. For that range or the subarray, we have to find the frequency of the given element present in that range. The frequency of the elements means that we have to tell for each integer present in that range how many times it occurs. For example − If, the given array is: [5, 2, 5, 3, ...

Read More

JavaScript Program for Removing Duplicates From An Unsorted Linked List

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 323 Views

The linked list is a linear data structure that consists of nodes, and each node is stored in memory in a non-contiguous manner. Nodes are connected by storing the address of the next node. We are given a linked list that will contain some integers in a random manner and not in a sorted manner. The task is to find the elements of the linked list which are repeated and we have to remove the duplicated ones. In this problem, we will keep the first copy of the elements of the linked list and remove the elements which are ...

Read More

JavaScript Program for Reversal algorithm for array rotation

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 335 Views

An array is a linear data structure used to store different types of objects. Given an array of size n and an integer k, we need to rotate the array by k elements to the left and return the rotated array. Rotation means shifting all elements to the left by k positions. Elements that move beyond the first position wrap around to the end of the array. Note − During rotation, when elements shift left, those at the beginning move to the end, creating a circular shift pattern. Let us see an example − Input: ...

Read More

JavaScript Program for Reversal algorithm for right rotation of an array

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 306 Views

Right rotation of an array means shifting elements to the right by a given number of positions. Elements that move beyond the array's end wrap around to the beginning. We'll implement the reversal algorithm, which is an efficient approach for array rotation. Example Input array: [1, 2, 3, 4, 5, 6, 7, 8, 9] Right rotations: 3 Output: [7, 8, 9, 1, 2, 3, 4, 5, 6] How Right Rotation Works Let's trace through 3 right rotations step by step: Original: [1, 2, 3, 4, 5, 6, 7, 8, 9] After 1st ...

Read More

JavaScript Program For Reversing A Linked List In Groups Of Given Size

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 320 Views

A linked list is a linear data structure that consists of interconnected nodes. Reversing a linked list means changing the order of all its elements. Reversing a linked list in groups of a given size means we divide the list into groups of k nodes and reverse each group individually. Problem Statement Given linked list: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> null Given group size: 3 Output: 3 -> 2 -> 1 -> 6 -> 5 -> 4 -> 8 -> 7 -> null Explanation: ...

Read More

How to create an array with multiple objects having multiple nested key-value pairs in JavaScript?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 6K+ Views

JavaScript is a versatile language that is widely used for creating dynamic web applications. One of the most common data structures used in JavaScript is the array. An array is a collection of elements that can be of any type, including objects. In this article, we will discuss how to create an array with multiple objects having multiple nested key-value pairs in JavaScript. What are arrays? An array is a special type of object that stores a collection of values. These values can be of any data type, such as numbers, strings, booleans, and even other arrays. Arrays ...

Read More

How to select all links inside the paragraph using jQuery?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 1K+ Views

jQuery is a popular JavaScript library that simplifies HTML DOM traversal, event handling, and AJAX interactions for rapid web development. It offers a wide range of built-in functions and methods that help developers to manipulate HTML elements, styles, and behaviors dynamically. In this article, we will see how to select all links inside a paragraph using jQuery. Selecting links inside a paragraph is a common requirement when we want to modify the links in a particular section of our website, such as changing styles, adding event handlers, or extracting link information. How to Select All Links Inside a ...

Read More
Showing 151–160 of 5,340 articles
« Prev 1 14 15 16 17 18 534 Next »
Advertisements