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
Articles on Trending Technologies
Technical articles with clear explanations and examples
JavaScript Robotics: Controlling Hardware with Johnny-Five and Arduino
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 MoreHow To Modify This JavaScript Code To Grab An Image URL From A JSON File, And Display It In HTML?
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 MoreJavaScript program to find the average of all negative numbers in an array
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 MoreJavaScript Testing Techniques: Integration Testing, E2E Testing, and Mocking
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 MoreHow to make a word count in textarea using JavaScript?
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 MoreCreating A Range Slider In HTML using JavaScript
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 MoreAdvanced JavaScript Memory Profiling and Heap Analysis
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 MoreTop 8 JavaScript Books For Beginners to Advanced
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 MoreJavaScript Program to Count rotations required to sort given array in non-increasing order
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 MoreHow to Select a Random Element from Array in JavaScript?
To select a random element from array in JavaScript, means getting any random element from the given array. We will understand various approaches for selecting a random element from array. In this article, we are having an array and our task is to select a random element from array in JavaScript Approaches to Select a Random Element from Array Here are the most effective approaches to select a random element from array in JavaScript which we will be discussing in this article with stepwise explanation and complete example codes. Using Math.random() ...
Read More