Articles on Trending Technologies

Technical articles with clear explanations and examples

How to set the style of an element's border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we shall learn to set the style of an element's border with JavaScript. To set the style of an element's border, use the borderStyle property in JavaScript. Let us discuss the borderStyle property available in detail. Using the borderStyle Property With the borderStyle property, we can set or return the style of an element's border. Syntax Following is the syntax to use the borderStyle property to set the style of an element's border with JavaScript − object.style.borderStyle = style; This syntax allows us to set the required border ...

Read More

World Map on HTML5 Canvas or SVG

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 889 Views

Creating interactive world maps in web browsers can be accomplished using SVG with libraries like Raphael.js or using HTML5 Canvas. This tutorial demonstrates both approaches for rendering world maps. Using SVG with Raphael.js Raphael.js is a JavaScript library that simplifies working with vector graphics in web browsers. Here's how to get started: // Create Raphael paper (canvas) var paper = Raphael("world-map", 800, 400); // Drawing basic shapes for map elements var circle = paper.circle(50, 40, 10); circle.attr("fill", "#f00"); circle.attr("stroke", "#fff"); // Create a simple country shape using path var country ...

Read More

Blank PNG image is shown with toBase64Image() function

Samual Sam
Samual Sam
Updated on 15-Mar-2026 305 Views

If a blank PNG image is shown with the toBase64Image() function, this typically occurs because the function is called before the chart finishes rendering. Here are two solutions to ensure the chart is fully rendered before converting to base64. Solution 1: Using Animation onComplete Callback Wait for the chart animation to complete before calling toBase64Image(): animation: { duration: 2000, onComplete: function (animation) { var base64Image = this.toBase64Image(); console.log(base64Image); ...

Read More

Change the Color of Link when a Mouse Hovers

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 1K+ Views

To change the color of a link when a mouse pointer hovers over it, use the CSS :hover pseudo-class. This creates an interactive effect that provides visual feedback to users. Syntax a:hover { color: desired-color; } Basic Example Here's how to change a link's color on hover: a { ...

Read More

Why doesn't JavaScript support multithreading?

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 581 Views

JavaScript is fundamentally single-threaded by design, executing code through an event loop mechanism. This architectural choice was made for specific reasons related to web development and browser safety. The Single-Threaded Nature JavaScript runs on a single main thread, processing one operation at a time. The Event Loop has one simple job — to monitor the Call Stack and the Callback Queue. If the Call Stack is empty, it will take the first event from the queue and push it to the Call Stack, which effectively runs it. console.log("First"); setTimeout(() => { ...

Read More

How to create responsive Modal Images with CSS and JavaScript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 3K+ Views

A modal is a dialog box/popup window that is displayed on top of the current page. Creating responsive modal images allows users to view enlarged versions of images that adapt to different screen sizes. Responsive modal images are images that enlarge to fit the viewport based on device resolution, orientation, and screen size. When clicked, they open in a modal overlay with smooth animations and can be easily closed by users. HTML Structure First, create the basic HTML structure with an image and modal container: ...

Read More

What are the uses of the JavaScript WITH statement?

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

The WITH statement is used to specify the default object for the given property and allow us to prevent writing long lengthy object references. It adds the given object to the head of the scope chain. Important: The with statement is deprecated and not recommended in modern JavaScript. It's disabled in strict mode and can cause performance and security issues. Syntax with (object) { // statements } Basic Example Here's how the with statement works with a simple object: ...

Read More

How to print star pattern in JavaScript in a very simple manner?

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

Here is a simple star pattern that we are required to print inside the JavaScript console. Note that it has to be printed inside the console and not in the output or HTML window: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Here's the code for doing so in JavaScript: Example const star = "* "; // where length is no of stars in longest streak const length = 6; for(let i = 1; i

Read More

Parse array to equal intervals in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 290 Views

Let's say, we are required to write a function, say parseEqualInterval() that takes in an array of Numbers of strictly two elements as the first argument and a number n as the second argument and it inserts n-1 equidistant entries between the actual two elements of the original array so that it gets divided into n equal intervals. For example: // if the input array is const arr = [12, 48]; // and the interval is 4 //then the output array should be: const output = [12, 21, 30, 39, 48]; This way the array ...

Read More

Leaders array JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 428 Views

An element in an array is a leader if it is greater than all elements on its right side. The rightmost element is always a leader since there are no elements to its right. For example, in the array [23, 55, 2, 56, 3, 6, 7, 1]: 56 is a leader (greater than 3, 6, 7, 1) 7 is a leader (greater than 1) 1 is a leader (rightmost element) Input: [23, 55, 2, 56, 3, 6, 7, 1] Output: [56, 7, 1] Using reduceRight() Method The most efficient approach is ...

Read More
Showing 16941–16950 of 61,297 articles
Advertisements