Alshifa Hasnain has Published 283 Articles

What is decrement (--) operator in JavaScript?

Alshifa Hasnain

Alshifa Hasnain

Updated on 11-Mar-2025 19:32:55

615 Views

The decrement operator in Javascript decreases an integer value by one. This operator is often utilized in loops, counters, and mathematical computations where a value has to be decreased sequentially. Types of Decrement Operators The decrement operator (--) can be used in two ways − ... Read More

Get the Size of an ArrayList in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 10-Mar-2025 19:41:47

53K+ Views

In this article, we will learn to get the size of an ArrayList in Java. In Java, an ArrayList is a resizable array implementation of the List interface. Unlike arrays, which have a fixed length, an ArrayList dynamically grows as elements are added. Using the size() Method The size of ... Read More

Java Program for Cocktail Sort

Alshifa Hasnain

Alshifa Hasnain

Updated on 10-Mar-2025 19:41:25

354 Views

In this article, we will learn to perform cocktail sorting in Java. Cocktail Sort, also known as Bidirectional Bubble Sort, is a variation of the standard Bubble Sort algorithm. What is Cocktail Sort? Cocktail Sort works in contrast to bubble sort, wherein elements are iterated from left to right, and ... Read More

What is $(document).ready() equivalent in JavaScript?

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Mar-2025 17:39:56

3K+ Views

In this article, we will learn to achieve the same result as $(document).ready in JavaScript. In jQuery, $(document).ready() is a widely used function that ensures the DOM (Document Object Model) is fully loaded before executing JavaScript code. Different approaches The following are the approaches to achieve the same result as ... Read More

Java program to check if a particular value exists in TreeMap

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Mar-2025 17:39:17

391 Views

In this article, we will learn to check if a particular value exists in TreeMap in Java. A Java TreeMap is an ordered map that keeps key-value pairs in ascending order of keys. Although it is efficient to look up a key, checking for a value is inefficient since one ... Read More

How to create an Array in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Mar-2025 17:38:36

3K+ Views

In this article, we will learn to create an Array in Java. Arrays provide an efficient way to manage and access data collections, making them essential for many programming tasks. What is an Array? A Java array is an ordered, fixed-size collection of elements of the same data type. Each ... Read More

Java program to decode string to integer

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-Mar-2025 19:22:31

548 Views

In this article, we will learn to decode string to integer in Java. Converting a string to an integer is a routine task in Java programming. It is helpful when working with user inputs, file operations, and data fetching from databases. Problem Statement The goal is to convert a given ... Read More

JavaScript program to count triplets with sum smaller than a given value

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-Mar-2025 19:22:19

439 Views

In this article, we will learn to count triplets with a sum smaller than a given value in JavaScript. Triplets in an array whose sum is less than a provided number is a popular problem in competitive coding and algorithm design. Problem Statement Given an array of integers and a ... Read More

JavaScript checking if all the elements are same in an array

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-Mar-2025 19:21:59

488 Views

In this article, we will learn to check if all the elements are the same in an array in JavaScript. Finding all elements of an array to be the same is a frequent problem in JavaScript, usually needed for data validation, game logic, and algorithm building. Problem Statement We are ... Read More

JavaScript - Set object key by variable

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-Mar-2025 19:21:37

345 Views

In this article, we will learn to set the object keys by variable in JavaScript. Objects are dynamic collections of properties. We can use variables to add or change properties rather than using static keys. This is specifically helpful when handling dynamic data, like user input. Dynamic Key Assignment In ... Read More

Advertisements