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
Front End Technology Articles
Page 317 of 652
How to Create and Save text file in JavaScript?
In this tutorial, we will learn to create and save text files in JavaScript. Sometimes, developers need to get text content from users and allow them to store it in a text file that can be downloaded to their local computer. JavaScript provides native methods to achieve this, and we can also use third-party libraries like FileSaver.js for enhanced functionality. Create a Text File Using Native JavaScript We can use native JavaScript operations to create and save text files on the user's computer. The approach uses the HTML tag with the Blob API to create downloadable ...
Read MoreRemove json element - JavaScript?
In JavaScript, you can remove elements from JSON objects or arrays using different methods. This article demonstrates how to remove properties from JSON objects and elements from JSON arrays. Sample JSON Data Let's work with the following JSON array containing customer information: var details = [ { customerName: "Chris", customerAge: 32 }, { customerName: "David", ...
Read MoreJavaScript - Get href value
JavaScript Get href Value is a useful tool for web developers and designers who need to quickly access the value of an HTML element's href attribute. This article will provide step-by-step instructions on how to use JavaScript to get the value of an href attribute on a webpage, as well as some tips and tricks for getting the most out of this powerful feature. The ability to quickly obtain the values from an HTML element's attributes can help make development faster and more efficient, so let's get started! The value of the href attribute in JavaScript is a ...
Read MoreJavaScript regex - How to replace special characters?
Characters that are neither alphabetical nor numeric are known as special characters. Special characters are essentially all unreadable characters, including punctuation, accent, and symbol marks. Remove any special characters from the string to make it easier to read and understand. Before we jump into the article let's have a quick view on the regex expression in JavaScript. Regex Expression in JavaScript Regular expressions are patterns that can be used to match character combinations in strings. Regular expressions are objects in JavaScript. These patterns can be used with the exec() and test() methods of RegExp as well as ...
Read MoreJavaScript 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 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 More