Front End Technology Articles

Page 120 of 652

How to Catch all JavaScript Errors and Send them to the Server?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 559 Views

JavaScript error handling is crucial for maintaining robust web applications. The window.onerror event allows you to catch all JavaScript errors globally and send them to your server for monitoring and debugging purposes. Understanding window.onerror The window.onerror event fires whenever an uncaught JavaScript error occurs in your application. It provides detailed information about the error including location and error details. Syntax window.onerror = (message, source, lineno, colno, error) => { // Handle error }; Parameters message: A string containing the error message that describes ...

Read More

How to filter an object depending on the field\'s value in JavaScript?

Aman Gupta
Aman Gupta
Updated on 15-Mar-2026 569 Views

Filtering objects by field values is a common JavaScript operation used in web applications. This technique allows you to extract specific data from arrays of objects based on certain criteria, such as filtering products by brand or employees by department. Basic Syntax The most efficient way to filter objects is using the filter() method: const filteredArray = array.filter(item => item.fieldName === fieldValue); array − Collection of objects to filter filter() − JavaScript method that creates a new array with elements passing the test item − Current object being processed fieldName − Property name ...

Read More

How to sort an array on multiple columns using JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 554 Views

An array with multiple columns is an array that contains multiple elements at each index position. In other words, it's an array of arrays where each sub-array represents a row with multiple column values that need to be sorted based on specific criteria. In this article, we'll learn how to sort arrays with multiple columns using JavaScript's sort() method combined with custom comparator functions. We'll explore different sorting strategies for various data types. Basic Syntax The fundamental approach uses a custom comparator function with the sort() method: array.sort((a, b) => { ...

Read More

How To Password Protect A Page Using Only HTML, CSS And JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 27K+ Views

To password protect a page using only HTML, CSS and JavaScript, is an important security measure for webpages that contain sensitive information or require authentication for access. In this article, we will understand how to create a simple form that requires users to enter a password before they can view the content of your protected page. Note: Client-side password protection provides basic content hiding but is not secure for truly sensitive data. For real security, use server-side authentication. Approaches to Password Protect a Page Here are two approaches to password protect a page using only HTML, CSS ...

Read More

How to Trigger a File Download when Clicking an HTML Button or JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 49K+ Views

To trigger a file download when clicking an HTML button or JavaScript, is a very common and important part of web page where users can directly download the file they want by clicking a button or link. We will be understanding four different approaches to achieve this. In this article, we are having a button in our HTML document and our task is to trigger a file download when clicking an HTML button or JavaScript. Approaches to trigger file download Here is a list of approaches to trigger a file download when clicking an HTML button or ...

Read More

JavaScript program to find if there is a subarray with 0 sum

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 664 Views

A subarray with a sum of 0 is a sequence of contiguous elements within an array where the sum of all elements in that sequence equals zero. Identifying such subarrays is a common problem in data analysis and coding challenges. The prefix sum technique efficiently solves this problem. In this article we will find if there is a subarray with 0 sum using JavaScript. The key insight is to use prefix sums (cumulative sums) along with a data structure to track previously seen sums: Continuously calculate the prefix sum while traversing the array ...

Read More

JavaScript Program to Find k Pairs with Smallest Sums in Two Arrays

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 435 Views

To find k pairs with smallest sums in two arrays in JavaScript, we will be using sorted arrays in ascending order. We are going to discuss two different approaches with stepwise explanation and examples. In this article we are having two arrays and a value of k, our task is to find k pairs with smallest sums in two arrays. Users must be familiar with JavaScript arrays, loops and conditional statement. Example Input: arr1 = [1, 7, 11], arr2 = [2, 4, 6] k = 3 Output: [[1, 2], [1, 4], [1, 6]] Input: ...

Read More

JavaScript Program to Find Closest Number in Array

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

To find closest number in array using JavaScript, we will be understanding and discussing three different approaches. We will also compare time and space complexities of all the approaches used. In this article we are having an array and a target value, our task is to find closest number to target value in array using JavaScript. User must know about JavaScript arrays, searching algorithms such as linear and binary search, sorting, loops, and conditional statements. Approaches to Find Closest Number in Array Here is a list of approaches to find closest number in array in JavaScript which ...

Read More

JavaScript Robotics: Controlling Hardware with Johnny-Five and Arduino

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

JavaScript is no longer limited to web development; it has expanded into controlling hardware devices, thanks to frameworks like Johnny-Five. Johnny-Five is a powerful and user-friendly JavaScript robotics library that allows developers to interact with hardware components like LEDs, motors, sensors, and more using microcontrollers such as Arduino. What is Johnny-Five? Johnny-Five is a JavaScript robotics and IoT (Internet of Things) platform that allows you to control hardware devices using JavaScript. It provides a simple and intuitive API that abstracts the complexities of working with electronics, making it easier for developers to prototype and experiment with physical computing ...

Read More

JavaScript Program to Check if a Matrix is Symmetric

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

A symmetric matrix is a square matrix that equals its transpose, meaning element at position (i, j) equals element at position (j, i). In mathematical terms, A = AT, where A is the matrix and AT is its transpose. In this article, we'll explore JavaScript programs to check if a given matrix is symmetric using different approaches. Original Matrix A 1 ...

Read More
Showing 1191–1200 of 6,519 articles
« Prev 1 118 119 120 121 122 652 Next »
Advertisements