Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Web Development Articles
Page 319 of 801
JavaScript Group a JSON Object by Two Properties and Count
When working with JSON data, you often need to group objects by multiple properties and count occurrences. This is useful for data analysis, creating summaries, or generating reports from complex datasets. What is JSON? JSON (JavaScript Object Notation) is a lightweight data format for transferring data between systems. It uses key-value pairs where keys are strings and values can be various data types. Each entry is separated by commas, for example: {"name": "Peter", "age": 25}. const jsonData = [ { ...
Read MoreJavaScript in filter an associative array with another array
In this article, we'll explore how to filter an associative array using another array in JavaScript. This is a common task when you need to extract specific objects from a dataset based on matching criteria. What is an Associative Array? An associative array is a data structure that stores key-value pairs. Each key is associated with a specific value and serves as a unique identifier. Unlike regular arrays, associative arrays don't use numeric indexes—keys can be strings or numbers. In JavaScript, objects function as associative arrays since they store key-value pairs where keys can be strings or ...
Read MoreHow to show images with a click in JavaScript using HTML?
To display images on click using JavaScript and HTML, you can create hidden images, add click events, and reveal images dynamically for an interactive user experience. This technique enhances user engagement and improves page load times by showing content only when needed. Users often want to create interactive web pages where images are initially hidden and can be revealed with a click. The challenge is implementing this functionality using JavaScript and HTML in a simple and efficient manner. Approaches to Show Images with a Click Using the Style Display Property Using ...
Read MoreHow to read JSON file in JavaScript?
There are three effective methods to read JSON files in JavaScript using fetch(), import statements, and require(). This article covers practical examples for both browser and Node.js environments. JSON (JavaScript Object Notation) is a lightweight data interchange format that's easy for humans to read and write. In this article, we'll explore three different approaches to reading JSON files in JavaScript: Approaches to Read JSON file Using the fetch() method (Browser) Using the import statement (ES6 Modules) Using the require() method (Node.js) Each method ...
Read MoreHow to open link in a new window using JavaScript?
If you want users to click on links and open those links in a new window because you want your user to stay on your site while they view the linked content, then you need to use this solution. By using JavaScript you can easily configure all of your links so that they open in a new window when clicked. Approach to Open Link in a New Window Using window.open() Method Using target="_blank" with onclick Using window.open() Method JavaScript window.open() method allows you to open a new ...
Read MoreJavaScript Sum odd indexed and even indexed elements separately and return their absolute difference
For a given list of elements, write a JavaScript program to find the sum of its odd and even indexed elements and then, calculate difference between them. To solve this problem, we will first separate odd indexed and even indexed elements. After separating them find their sum separately and store it in different variables. Now, we will calculate the difference between these sums to get desired result. Example Scenario: Input: list = [11, 21, 31, 41, 51, 61]; Output: difference = 30 Here, odd-indexed items are [21, 41, 61] and their sum is ...
Read MoreJavaScript knowledge required for GTM (Google Tag Manager)
The Google Tag Manager (GTM) is a tag management system that allows you to configure and rapidly deploy tags on your website or mobile app using a simple web-based interface. It has the same capabilities as the Google Tag, a JavaScript library used to send data from your website to Google Analytics. Tag Manager also supports tag version management and organization, community and third-party-developed tag templates, enterprise collaboration tools, and security features. JavaScript for Google Tag Manager Before you start using Google Tag Manager effectively, understanding these JavaScript fundamentals is essential: Basic ...
Read MoreJavaScript: How to check if a number is even without using the modulo operator?
For a given integer number, write a program in JavaScript to check whether a number is odd or even and return the same to the user. It's pretty easy to check whether a number is even by using the modulo operator. But, in this article, we will be checking whether a number is even or not without using the modulo operator. Using the For Loop In this approach, we are going to use the for loop to check whether a number is even or not. The idea is to take a Boolean flag variable as true and toggle ...
Read MoreCreating Animated Counter using HTML, CSS, and JavaScript
An animated counter is a display that smoothly transitions from one number to another, typically starting from 0 and counting up to a target value. This creates an engaging visual effect commonly used in dashboards, statistics displays, and landing pages. In this article, we'll create an animated counter using HTML for structure, CSS for styling, and JavaScript for the animation logic. Steps for Creating Animated Counter Follow these steps to build the animated counter: Create two div elements: one container for styling and one to display the counter value. ...
Read MoreHow to Become a JavaScript Developer?
A JavaScript developer is a programmer who specializes in creating interactive and dynamic web applications using JavaScript, the world's most popular programming language. JavaScript developers build everything from simple website interactions to complex single-page applications, mobile apps, and even server-side applications using Node.js. JavaScript developers work on both front-end development (user-facing interfaces) and back-end development (server-side logic). They collaborate with designers, other developers, and stakeholders to create responsive, user-friendly web experiences that run seamlessly across different browsers and devices. Essential Skills for JavaScript Developers To become a successful JavaScript developer, you'll need to master several core technologies ...
Read More