Alshifa Hasnain has Published 283 Articles

JavaScript: take every nth Element of Array and display a fixed number of values?

Alshifa Hasnain

Alshifa Hasnain

Updated on 16-Jan-2025 20:22:07

782 Views

In this article, we will learn to extract every nth element from an array and display a fixed number of values in Javascript. The objective is to filter out every second element (or more generally every nth element) from an array and limit the result to a specified count of ... Read More

JavaScript Narcissistic number

Alshifa Hasnain

Alshifa Hasnain

Updated on 15-Jan-2025 18:59:23

795 Views

In this article, we will learn to check if a number is Narcissistic in JavaScript. A Narcissistic number is a number that equals the sum of its digits, each raised to the power of the total number of digits. We will explore two approaches to solve this problem an iterative ... Read More

Format date with DateFormat.LONG in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 15-Jan-2025 18:58:25

2K+ Views

In this article, we will learn to use DateFormat.LONG to format dates in Java. Handling dates and times efficiently is crucial for most applications. The Java Date and DateFormat classes provide a flexible and simple way to format dates and times. What is DateFormat.LONG? DateFormat.LONG is a constant provided by ... Read More

Java Program to enable cell selection in a JTable

Alshifa Hasnain

Alshifa Hasnain

Updated on 15-Jan-2025 18:58:02

767 Views

In this article, we will learn to enable cell selection in a JTable in Java Swing. By default, JTable allows row or column selection, but enabling cell selection gives users the ability to select individual cells. This feature is useful for tasks that require precise control over table data, such ... Read More

JavaScript - array undefined element count

Alshifa Hasnain

Alshifa Hasnain

Updated on 14-Jan-2025 03:27:25

825 Views

In this article, we will learn to count the number of undefined elements in an array using JavaScript. When working with arrays in JavaScript, you may encounter situations where certain elements are either explicitly set as undefined or are missing altogether (often represented by empty slots in sparse arrays). Problem ... Read More

JavaScript equivalent of Python's zip function

Alshifa Hasnain

Alshifa Hasnain

Updated on 14-Jan-2025 03:27:00

1K+ Views

In this article, we will learn the JavaScript equivalent of Python's zip Function In Python, the zip() function is a convenient way to combine multiple tables into a single iterable of tuples. However, JavaScript does not have a built-in equivalent for this functionality Problem Statement Given two or more arrays ... Read More

JavaScript: How to loop through all DOM elements on a page and display result on console?

Alshifa Hasnain

Alshifa Hasnain

Updated on 14-Jan-2025 03:24:47

1K+ Views

In this article, we will learn how to iterate through all DOM elements on a webpage using JavaScript. By doing so, we can easily access and manipulate various elements of the page, whether for debugging, gathering information, or applying changes to the page's structure and content. We'll walk through a ... Read More

Java Program to Print Upper Star Triangle Pattern

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Jan-2025 18:56:02

977 Views

In this article, we will learn to print the upper star triangle pattern in Java. Printing patterns is a common exercise to strengthen the understanding of loops in programming. One of the most popular patterns is the Upper Star Triangle, which visually resembles an inverted right-angled triangle of stars aligned ... Read More

Java Program to convert integer to String with Map

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Jan-2025 18:55:45

695 Views

In this article, we will learn to convert integers to String with Map in Java. The Stream API has become an essential tool for processing collections of data in a more declarative and readable way. Instead of using traditional loops, streams allow developers to filter, map, and perform other operations ... Read More

JavaScript Regex to remove leading zeroes from numbers?

Alshifa Hasnain

Alshifa Hasnain

Updated on 06-Jan-2025 22:49:55

1K+ Views

In this article, we will learn to remove leading zeroes from numbers in JavaScript using Regex. When working with numeric strings in JavaScript, it’s common to encounter unwanted leading zeroes. These zeroes can cause issues when parsing numbers, formatting data, or displaying user-friendly outputs. Why Remove Leading Zeroes in JavaScript? ... Read More

Advertisements