How to filter nested objects in JavaScript?

Aman Gupta
Updated on 15-Mar-2026 23:19:01

3K+ Views

Filtering nested objects in JavaScript is a common task when working with complex data structures. Nested objects contain objects as values within their properties, and JavaScript's filter() method allows us to filter arrays of such objects based on conditions that access nested properties. Understanding Nested Objects A nested object is an object that contains other objects as property values. For example, a product object might have a nested price object: const product = { id: 1, name: "Laptop", price: { ... Read More

JavaScript Robotics: Controlling Hardware with Johnny-Five and Arduino

Mukul Latiyan
Updated on 15-Mar-2026 23:19:01

638 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

How To Modify This JavaScript Code To Grab An Image URL From A JSON File, And Display It In HTML?

Yaswanth Varma
Updated on 15-Mar-2026 23:19:01

10K+ Views

This can be done by using the JavaScript method JSON.parse() to parse through the JSON file and extract the URL of the desired image. Then, an HTML img tag can be created with a source attribute set to this URL. Finally, this img tag can be appended to an existing HTML element in order to display it on your page. This will require some knowledge of basic JavaScript syntax, as well as familiarity with how JSON is structured and parsed within it. With these skills in hand, you should have no trouble modifying your code to achieve your goal! ... Read More

JavaScript program to find the average of all negative numbers in an array

AYUSH MISHRA
Updated on 15-Mar-2026 23:19:01

6K+ Views

In this problem, we are given an array of integers, which may contain both negative and positive numbers. We have to find the average of all the negative numbers in the array. In this article, we are going to learn how we can find the average of all negative numbers in an array using JavaScript. Problem Examples Example 1 Input: arr = [1, -3, 4, -2, -5]; Output: -3.33 Explanation: The negative numbers in the array are -3, -2, and -5. Their sum is -10, and the number of negative elements is 3. The average is: ... Read More

JavaScript Testing Techniques: Integration Testing, E2E Testing, and Mocking

Mukul Latiyan
Updated on 15-Mar-2026 23:19:01

403 Views

Testing plays a crucial role in ensuring the quality and reliability of JavaScript applications. While unit testing is widely adopted, advanced testing techniques such as integration testing, end-to-end (E2E) testing, and mocking are equally important in delivering robust applications. In this article, we will explore these advanced JavaScript testing techniques, providing theoretical explanations, code examples, and their benefits. Integration Testing Integration testing focuses on verifying the interactions and dependencies between different components of an application. It ensures that individual units work together harmoniously. JavaScript frameworks like Jest, Mocha, and Jasmine provide excellent support for integration testing. Example: ... Read More

How to make a word count in textarea using JavaScript?

Saba Hilal
Updated on 15-Mar-2026 23:19:01

2K+ Views

Creating a word counter for textarea elements is a common requirement in web applications. This functionality helps users track their input length, especially useful for forms with character or word limits. We'll explore two different JavaScript approaches to implement this feature. Method 1: Counting Words by Analyzing Spaces and Newlines This approach manually iterates through each character in the textarea, counting spaces and newline characters to determine word boundaries. Implementation Steps Step 1 − Create an HTML file with a textarea element Step 2 − Add paragraph elements to ... Read More

Creating A Range Slider In HTML using JavaScript

Yaswanth Varma
Updated on 15-Mar-2026 23:19:01

1K+ Views

On web pages, range sliders are used to let users specify a numeric value within a defined range. Instead of typing exact numbers, users can simply drag a slider control to select their desired value. This makes range sliders perfect for settings where precision isn't critical, such as volume controls, brightness adjustments, or filtering options. HTML provides the element for creating basic sliders, but with JavaScript and CSS, we can enhance them to create more interactive and visually appealing controls. HTML input type="range" The creates a slider control for selecting numeric values. By default, it ... Read More

Advanced JavaScript Memory Profiling and Heap Analysis

Mukul Latiyan
Updated on 15-Mar-2026 23:19:01

451 Views

Efficient memory management is crucial for optimising the performance and stability of JavaScript applications. Memory leaks and excessive memory usage can lead to degraded performance, crashes, and poor user experiences. To address these issues, JavaScript provides several advanced techniques for memory profiling and heap analysis. In this article, we will explore these techniques, accompanied by code examples and outputs, to gain a comprehensive understanding of how to optimise memory usage in JavaScript applications. Understanding Memory in JavaScript JavaScript uses automatic memory management, where a garbage collector frees up memory by identifying and deallocating objects that are no longer ... Read More

Top 8 JavaScript Books For Beginners to Advanced

vivek Raj Singh
Updated on 15-Mar-2026 23:19:01

621 Views

JavaScript is a versatile, powerful language that can also be used for server-side scripting, opening up numerous career opportunities in web development. Understanding JavaScript is essential whether you're just starting out or already on your coding journey. The recommended books below offer various approaches to mastering JavaScript, helping you become a more creative and effective developer. Top 8 JavaScript Books For Beginners to Advanced Here are my top 8 book recommendations for mastering JavaScript. Whether you're a beginner or an experienced developer, there's something valuable for everyone on this list. JavaScript: The ... Read More

JavaScript Program to Count rotations required to sort given array in non-increasing order

AmitDiwan
Updated on 15-Mar-2026 23:19:01

231 Views

We will be writing a program to count the number of rotations required to sort an array in non-increasing order. A rotation moves the first element to the end of the array. The program identifies where the array starts to break the non-increasing pattern and calculates the minimum rotations needed. Understanding the Problem For an array to be sorted in non-increasing order, each element should be greater than or equal to the next element. If we have a rotated sorted array, we need to find the rotation point and calculate how many positions we need to rotate to ... Read More

Advertisements