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
Building Progressive Web Games with JavaScript and HTML5 Canvas
In recent years, the web platform has evolved significantly, enabling developers to create more powerful and interactive applications. With the introduction of HTML5 and JavaScript, developers now have the tools to build not just websites but also games that can run directly in the browser. In this article, we will explore the process of building a Progressive Web Game using JavaScript and HTML5 Canvas, with a practical example of a "Brick Breaker" game. What are Progressive Web Games? Progressive Web Games are web-based games that leverage modern web technologies to provide a rich and immersive gaming experience. ...
Read MoreDifference between indexOf and findIndex Function
JavaScript provides several methods to find the index of elements in arrays. Two commonly used methods are indexOf and findIndex. While both return the index of a matching element, they work differently and have distinct use cases. The indexOf Function The indexOf method searches for a specific element in an array and returns the first index where it's found. If the element doesn't exist, it returns -1. Syntax array.indexOf(element, startIndex) Parameters element: The value to search for startIndex (optional): Position to start searching from Example const months ...
Read MoreBuilding Real-Time Collaborative Editing Applications with JavaScript and Operational Transformation
Real-time collaborative editing applications have become increasingly popular in today's digital world. These applications allow multiple users to simultaneously edit and collaborate on shared documents or projects. One of the key challenges in building such applications is handling concurrent edits made by different users. JavaScript, being a widely used programming language for web development, provides robust tools and frameworks to implement real-time collaboration features. In this article, we will explore how to build real-time collaborative editing applications with JavaScript using the concept of operational transformation. We will provide code examples, explanations, and a final conclusion to summarise the key ...
Read MoreHow to Detect if An \'IMG\' Element Load Has Started And/or a Request Has Been Made to the Server?
Sometimes when inserting images into HTML sites, the image may not load for the following reasons: Incorrect image URL Network connectivity issues Server downtime or slow response Detecting if an IMG element load has started and/or a request has been made to the server is crucial for handling loading states and providing better user experience. Let's explore different methods to achieve this. HTML Tag Overview The HTML tag is used to embed images in web pages. It creates a holding space for the ...
Read MoreHow to dynamically create new elements in JavaScript?
In this article, we will learn how to dynamically create new elements in JavaScript with the help of the createElement browser API. Dynamic element creation in JavaScript allows you to generate new HTML elements on the fly. Whether you need to add content to a web page based on user interactions or dynamically generate elements for a specific task, it can help enhance the flexibility and interactivity of web applications. Let's understand how to implement this with the help of some examples. Using createElement() and appendChild() In this example, we will have a button element and ...
Read MoreHow to Convert JSON to Excel in JavaScript?
Converting JSON data to Excel format is a common requirement in web applications, especially for data export and reporting functionality. Excel files are widely used for data presentation and analysis, making JSON-to-Excel conversion essential for seamless data management. This article explores different methods to convert JSON data to Excel files using JavaScript, including library-based approaches and manual techniques. Approaches to Convert JSON to Excel in JavaScript Using the SheetJS (xlsx) library Manual HTML Table Export Exporting JSON to CSV format Using the SheetJS ...
Read MoreBuilding Robot Arms with JavaScript and Robotics Frameworks
JavaScript, the popular programming language known for its versatility and ease of use in web development, has expanded its reach beyond the realm of browsers. With the rise of the Internet of Things (IoT) and the increasing demand for robotics applications, JavaScript has found its way into the world of robotics. In this article, we will explore how JavaScript can be used to build and control robot arms, leveraging the power of robotics frameworks. Understanding Robotics Frameworks Before diving into the practical implementation, let's take a moment to understand what robotics frameworks are and how they can benefit ...
Read MoreFile Type Validation while Uploading it using JavaScript
File type validation is essential for web applications that handle file uploads. It ensures users only upload acceptable file formats, preventing security issues and maintaining data consistency. JavaScript provides built-in properties to check file types before submission. This validation process helps platforms like job portals, social media sites, and document management systems control what file types users can upload, such as restricting uploads to PDFs for resumes or images for profile pictures. How File Type Validation Works When a user selects a file, the browser exposes file information through the File API. The key property is file.type, ...
Read MoreHow to Create Protected Object Properties in JavaScript?
JavaScript does not have built-in access modifiers like other languages, but we can create protected object properties using closures and WeakMap. Protected properties are accessible only through specific methods and cannot be directly accessed from outside the object, providing encapsulation and data security. Approaches to Create Protected Object Properties Using Closures Using WeakMap Using Private Fields (ES2022) Using Closures Closures create a private scope where variables are accessible only to inner functions, effectively protecting properties from external access. function ProtectedObject(name, age) ...
Read MoreJavaScript Program to Find array sum using Bitwise OR after splitting given array in two halves after K circular shifts
We will write a JavaScript program to find the sum of an array by using bitwise OR after splitting the given array into two halves after K circular shifts. Our program will perform the task by taking an array and an integer K as inputs. First, we will split the array into two halves after performing K circular shifts. Then, we will perform bitwise OR on both the halves to get a new array. Finally, we will find the sum of the new array obtained from the bitwise OR operation. Approach First, perform K ...
Read More