Articles on Trending Technologies

Technical articles with clear explanations and examples

JavaScript Program for Count Primes in Ranges

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 4K+ Views

Prime numbers are numbers that have exactly two perfect divisors (1 and themselves). This article explores multiple methods to count prime numbers in a given range using JavaScript. We'll start with basic approaches and then optimize using the Sieve of Eratosthenes algorithm for better performance. Method 1: Direct Approach (O(N) per number) This method counts all divisors of a number. If exactly 2 divisors exist, the number is prime. function isPrime(number) { var count = 0; for (var i = 1; i

Read More

Find 1st January be Sunday between a range of years in JavaScript?

Nikesh Jagsish Malik
Nikesh Jagsish Malik
Updated on 15-Mar-2026 645 Views

Finding years where January 1st falls on a Sunday is useful for planning events, scheduling, and calendar calculations. JavaScript's Date object makes this straightforward by providing methods to determine the day of the week. How It Works The approach uses JavaScript's Date constructor and getDay() method. The getDay() method returns 0 for Sunday, 1 for Monday, and so on. We iterate through a range of years, create a Date object for January 1st of each year, and check if it's a Sunday. Method 1: Direct Sunday Check This method directly checks if getDay() returns 0 (Sunday): ...

Read More

Firebase Integration with Web

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 733 Views

Firebase is a comprehensive Backend-as-a-Service (BaaS) platform launched by Google in 2011 and acquired in 2014. It provides real-time databases, user authentication, cloud storage, hosting, and analytics for mobile and web applications. Its popularity stems from quick setup, scalability, and seamless integration. In this tutorial, we will learn to integrate Firebase authentication into a single-page web application, creating a complete user management system with signup, login, and logout functionality. Setting Up Firebase Project Follow these steps to create and configure your Firebase project: Step 1 − Visit Firebase and create a Google ...

Read More

How to Declare Constants in React Class?

Rohan Singh
Rohan Singh
Updated on 15-Mar-2026 3K+ Views

When developing applications with React, it's necessary to declare constants to store values that remain unchanged throughout the lifecycle of a component or application. Constants can help improve code readability, provide a central location for managing shared values, and enhance maintainability. In this article, we'll explore how to declare constants in a React class component. Importing React To begin, let's assume you have set up your React environment and have a class component ready for use. Before declaring constants, make sure you have imported the necessary libraries. This includes importing React, which is the core library for building ...

Read More

How to switch the language of the page using JavaScript?

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

Whenever you develop a website or application for a worldwide business, you must also focus on which language your audience can understand. For example, English is an international language, but in some parts of the world, people don't understand English as they speak German, Spanish etc. However, if you have observed, then some websites provide the option to change the website's language. You just need to click on the button, which changes the whole website's language. Have you ever thought about how it is possible? Here, we will learn to switch the language of the web page using ...

Read More

How to delay a loop in JavaScript using async/await with Promise?

Rohan Singh
Rohan Singh
Updated on 15-Mar-2026 3K+ Views

Some time−consuming tasks are executed without blocking the main thread in Asynchronous programming. In certain cases, developers may need to delay the execution of a loop to control the flow of their program or introduce delays between iterations. JavaScript provides several techniques for delaying execution, and in this article, we will explore how to delay a loop using the combination of async/await and Promises. Understanding async/await The async/await syntax was introduced in ECMAScript 2017 (ES8) and provides a concise and readable way to write asynchronous code. It is built on top of Promises and allows developers to write ...

Read More

Firebase to get url

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

Firebase is a backend-as-a-service (BaaS) that provides different services including authentication, cloud storage, hosting, and more. It makes it easy for developers to integrate these features into mobile or web applications. In this tutorial, we will explore Firebase Cloud Storage to upload images and retrieve their URLs for use in web applications. Firebase Project Setup Follow these steps to set up a Firebase project and configure cloud storage: Step 1 − Go to Firebase and create an account. Step 2 − Open the Firebase Console. Step 3 − Click the 'Create project' button to start ...

Read More

JavaScript Program to Find Minimum Insertions to Form a Palindrome

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

We are given a string and we have to find the minimum number of characters that we need to insert at any position to make the string a palindrome. A palindrome is a string that reads the same forwards and backwards. This problem can be solved using dynamic programming - we'll explore three approaches: recursive, memoization, and tabulation. Understanding the Problem For example, to make "abc" a palindrome, we need to insert 2 characters to get "abcba" or "cbabc". The key insight is that if characters at both ends match, we can focus on the substring between them. ...

Read More

Advanced JavaScript Patterns: Singleton, Decorator, and Proxy

Mukul Latiyan
Mukul Latiyan
Updated on 15-Mar-2026 338 Views

JavaScript is a versatile programming language that allows developers to create dynamic and interactive web applications. With its vast array of features and flexibility, JavaScript enables the implementation of various design patterns to solve complex problems efficiently. In this article, we will explore three advanced JavaScript patterns: Singleton, Decorator, and Proxy. These patterns provide elegant solutions for managing object creation, adding functionality dynamically, and controlling access to objects. Singleton Pattern The Singleton pattern ensures that a class has only one instance and provides a global point of access to it. This pattern is useful when we want to ...

Read More

JavaScript Program for Counting Frequencies of Array Elements

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 2K+ Views

Counting frequencies of array elements means determining how many times each element appears in an array. This is a common programming task useful for data analysis, statistics, and various algorithms. JavaScript provides multiple approaches to solve this problem efficiently. In this article, we'll explore five different methods to count element frequencies in JavaScript. Each approach has its own advantages - some prioritize simplicity, others performance, and some leverage built-in methods or external libraries. Approaches to Count Array Elements Frequencies Here are the five approaches we'll cover, each with detailed explanations and complete working examples: ...

Read More
Showing 14071–14080 of 61,297 articles
Advertisements