Articles on Trending Technologies

Technical articles with clear explanations and examples

How to read data from *.CSV file using JavaScript?

Lokesh Badavath
Lokesh Badavath
Updated on 15-Mar-2026 41K+ Views

In this article, we are going to learn how to read data from *.CSV file using JavaScript. To convert or parse CSV data into an array, we need JavaScript's FileReader class, which contains a method called readAsText() that will read a CSV file content and parse the results as string text. If we have the string, we can create a custom function to turn the string into an array. To read a CSV file, first we need to accept the file. Now let's see how to accept the csv file from browser using HTML elements. ...

Read More

Atomics.isLockFree() function in JavaScript

Samual Sam
Samual Sam
Updated on 15-Mar-2026 193 Views

The Atomics object in JavaScript provides atomic operations for use with SharedArrayBuffer objects in multi-threaded environments. The Atomics.isLockFree() method determines whether the JavaScript engine can perform atomic operations on a given byte size without using locks. This method helps optimize performance by checking if atomic operations are lock-free for specific data sizes, which is crucial for high-performance concurrent programming. Syntax Atomics.isLockFree(size) Parameters size: An integer representing the size in bytes. Valid values are typically 1, 2, 4, or 8 bytes corresponding to Int8, Int16, Int32, or BigInt64 array types. Return Value ...

Read More

JavaScript Detecting a mobile browser

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 261 Views

Detecting mobile browsers in JavaScript is essential for responsive web design and providing device-specific functionality. This can be achieved using the navigator.userAgent property to identify mobile device patterns. Basic Mobile Detection The most common approach uses regular expressions to check the user agent string for mobile device identifiers: Mobile Detection body { font-family: "Segoe ...

Read More

How to import local json file data to my JavaScript variable?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 34K+ Views

When working with local JSON files in JavaScript, you need to import the data into your JavaScript variables. This article demonstrates how to load JSON data from a local file using different methods depending on your environment. Let's say we have an employees.json file in our project directory: Sample JSON File employees.json { "Employees": [ { "userId": "ravjy", "jobTitleName": "Developer", "firstName": "Ran", "lastName": "Vijay", ...

Read More

How could I write a for loop that adds up all the numbers in the array to a variable in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 998 Views

To sum all numbers in an array, initialize a total variable to 0, then iterate through the array and add each element to the total. Let's say the following is our array with numbers: var listOfValues = [10, 3, 4, 90, 34, 56, 23, 100, 200]; Using a for Loop var listOfValues = [10, 3, 4, 90, 34, 56, 23, 100, 200]; var total = 0; for (let index = 0; index < listOfValues.length; index++) { total = total + listOfValues[index]; } console.log("Total Values = " + ...

Read More

How to remove an item from JavaScript array by value?

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

In this tutorial, we will learn to remove an item from a JavaScript array by value. An array is a data structure that can store a collection of elements. JavaScript provides several methods to manipulate arrays, including removing specific elements by their value rather than their index position. Following are the main methods to remove an item from an array by value: The Array filter() Method The Array splice() Method with indexOf() Using the Array filter() Method The filter() method creates a new array containing elements that ...

Read More

How to get the number of the internet host port for the current page in JavaScript?

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

In this tutorial, we will learn to get the number of internet host port for the current page in JavaScript. The Port number is a 16-bit unique identifier used by network protocols. Port numbers range from 0-65535 and help servers identify specific processes or services. Each port number has its own identity and purpose in network communication. Following are the methods by which we can get the port number of the internet host: Using the location.port Property Using the URL interface Using the location.port Property ...

Read More

How to set whether the text of an element can be selected or not with JavaScript?

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

In this tutorial, we will learn to set whether the text of an element can be selected or not with JavaScript. Use the userSelect property in JavaScript to enable or disable a text selection. For Firefox, use the MozUserSelect property and set it to none, to disable the selection. The CSS user-select property can set the text on a web page as selectable or nonselectable. But, sometimes, we must restrict the selection to a triggered event or a condition. Then, we can use the JavaScript DOM that provides nearly all CSS properties. So, let us look at how ...

Read More

Is their a negative lookbehind equivalent in JavaScript?

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 135 Views

JavaScript supports negative lookbehind assertions in modern environments (ES2018+), but older browsers require workarounds using character classes and capturing groups. Modern Negative Lookbehind (ES2018+) ES2018 introduced native negative lookbehind syntax (?: let text = 'He said "hello" and she said "goodbye"'; let result = text.replace(/(? breaks down as: (^|[^\]) — Captures either start of string OR any character except backslash " — Matches the quote to replace $1' — Replaces with the captured character plus single quote Browser Compatibility Comparison Method Browser Support Performance Native (? Chrome ...

Read More

Enhance real-time performance on HTML5 canvas effects

Samual Sam
Samual Sam
Updated on 15-Mar-2026 642 Views

HTML5 canvas performance optimization is crucial for smooth real-time effects like animations, games, and interactive graphics. Here are proven techniques to boost your canvas rendering speed. Disable Image Smoothing Turn off image smoothing for pixel-perfect rendering and better performance: const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Disable smoothing for better performance ctx.imageSmoothingEnabled = false; ctx.webkitImageSmoothingEnabled = false; ctx.mozImageSmoothingEnabled = false; // Test with a small image scaled up const img = new Image(); img.onload = function() { ctx.drawImage(img, 0, 0, 200, 150); ...

Read More
Showing 16741–16750 of 61,297 articles
Advertisements