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
Javascript Articles
Page 54 of 534
What is the role of deferred scripts in JavaScript?
The defer attribute in JavaScript is a crucial performance optimization tool that controls when scripts execute during page loading. It ensures scripts run only after the HTML document has been completely parsed, preventing blocking behavior that can slow down page rendering. The Problem with Regular Scripts When a browser encounters a regular tag, it stops HTML parsing, downloads the script, executes it, and then continues parsing. This blocking behavior creates performance bottlenecks and delays page rendering. Regular Script Loading (Blocking) HTML Parsing Script ...
Read MoreWhat is the use of stopPropagation method in JavaScript
The stopPropagation() method prevents events from bubbling up through the DOM tree to parent elements. When an event occurs on a child element, it normally triggers on all parent elements too - this method stops that behavior. The Event Bubbling Problem In JavaScript, events "bubble up" from child to parent elements. For example, if a button is inside a div and both have click handlers, clicking the button triggers both events. The stopPropagation() method prevents this propagation. Syntax event.stopPropagation(); Example: Event Bubbling Without stopPropagation Event ...
Read MoreWhy is JavaScript considered a loosely-typed language
JavaScript is considered a loosely typed language because you don't need to declare variable types explicitly. JavaScript automatically determines the data type based on the value assigned to the variable. This flexibility sets it apart from strongly typed languages like Java or C++. What Makes JavaScript Loosely Typed? In JavaScript, you can assign any type of value to a variable without declaring its type: JavaScript Loose Typing Example let variable = 42; ...
Read MoreHow to change video playing speed using JavaScript?
In this article, we'll learn how to control video playback speed using JavaScript's HTML5 video properties. This allows users to watch videos at different speeds for better accessibility or user experience. The playbackRate property controls video speed: values less than 1 slow down the video, values greater than 1 speed it up, and 1 returns to normal speed. Note that playbackRate is a JavaScript property, not an HTML attribute. Syntax To change the current playback speed: let video = document.querySelector('video'); video.playbackRate = newSpeed; To set the default playback speed: let video ...
Read MoreDisplay selected checkboxes on another page using JavaScript?
In this article, you will learn how to pass selected checkbox values from one page to another using JavaScript and localStorage. Checkboxes allow users to select multiple values, unlike radio buttons which only allow single selection. When a checkbox is checked, it represents a "true" value indicating user selection. Basic Checkbox Example Example checkbox This creates a simple checkbox that shows an alert when clicked. Getting Checkbox Values on Same Page First, let's see how to collect checked values within the same ...
Read MoreVisually improving a website using JavaScript?
In this article, you will learn various techniques to make your website attractive and fast using JavaScript, which will increase user engagement and make your website more productive. What is JavaScript? JavaScript is a web development language used to add functionality and interactivity to websites. It makes websites dynamic, robust, faster, and more engaging. JavaScript is an interpreted scripting language that runs directly in web browsers without needing compilation, making it one of the most popular languages in modern software development. To develop a complete website, you need three fundamental technologies: HTML ...
Read MoreRole of JavaScript in Software Companies?
In this article, you will learn about the importance and role of the JavaScript language in the software industry. Where do we use the language and how it helps in production in the software companies everything we will get to know. JavaScript is one of the web development languages used to add functionality to the website. It makes the website interactive, robust, faster, and prettier. It's a scripting, interpreted language that can be directly compiled in a web browser like C, or CPP; it doesn't need a compiler to compile. Basically, to develop a website we need three ...
Read MoreHow to disable right-clicking on a website using JavaScript?
To disable right-clicking on a website using JavaScript, you can use the contextmenu event to cancel the default behavior of the right-click. The contextmenu event is a DOM event that is triggered when a user right-clicks on an element in a user interface. It is a type of mouse event, similar to the click event, but it is specific to right-clicks. In JavaScript, you can use the addEventListener method to attach a contextmenu event listener to an element. The event listener function will be called whenever the contextmenu event is triggered on the element. Here's an example ...
Read MoreHow To Run JavaScript Online?
In this tutorial, we'll explore the best ways to run JavaScript code online without installing any software. Running JavaScript online is essential for quick testing, learning, and sharing code snippets. JavaScript can run in any web browser, but online editors provide enhanced features like syntax highlighting, error detection, and easy sharing. Let's examine the top platforms for running JavaScript online. Browser Console (Built-in Option) The simplest way to run JavaScript is using your browser's console. Press F12 to open Developer Tools, then navigate to the Console tab. console.log("Hello from browser console!"); let x = 5 ...
Read MoreWhich Android Browser Has The Best JavaScript Support?
In this tutorial, we explore which Android browser provides the best JavaScript support for developers and users. Most modern browsers support JavaScript due to its popularity and essential role in web development. Android browsers have evolved significantly to provide comprehensive JavaScript support, making mobile web development more powerful and consistent with desktop experiences. The leading browsers with excellent JavaScript support include Chrome, Firefox, Safari, Opera, and Edge. On Android devices, Chrome serves as the primary browser that most developers rely on for testing and development. Before testing JavaScript functionality, ensure that JavaScript is enabled in your browser ...
Read More