Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 17 of 80

How to set the color of the left border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 764 Views

In this tutorial, we will learn how to set the color of the left border with JavaScript. To set the color of the left border in JavaScript, use the borderLeftColor property. Set the color on this property that you want for the border. We could also apply the borderColor property to set the color of the left border. A border is an HTML element's outline. Different sides can be set with different border colors. To set the color of the left border with JavaScript, we have different ways − Using the style.borderLeftColor property ...

Read More

How to convert Number to Boolean in JavaScript?

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

This tutorial will teach us to convert a number to a Boolean in JavaScript. The variable of Boolean data type can contain only two values, true and false. When we convert the variables of any other data type to Boolean, it returns true for all non-falsy values and false for all falsy values. Let's understand the falsy values. JavaScript contains 6+ falsy values, and some of them are as below. Null 0 NaN False Undefined ' ' (empty string) ...

Read More

How to check whether a checkbox is checked in JavaScript?

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

In this tutorial, we will learn to check whether a checkbox is checked in JavaScript. The checkbox is an input type in HTML that works as a selection box. Unlike radio buttons which allow users to select only one value from a group, checkboxes allow users to select multiple values. HTML can add checkboxes to webpages, but JavaScript is needed to add behavior based on whether checkboxes are checked or not. We'll learn to check both single and multiple checkboxes. Check if a Single Checkbox is Selected To check if a checkbox is selected, we access the ...

Read More

How to pad a number with leading zeros in JavaScript?

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

In this tutorial, we will learn how to pad a number with leading zeros in JavaScript. Padding a number can be done in different ways in JavaScript. In this tutorial, we will see the two most popular ways of doing it − Using the String padStart() method Using the Array object constructor and join() method Using the String padStart() Method In JavaScript, the String object's padStart() method is useful to pad a number with leading zeros. It takes two parameters, the first one is the total length of the targeted or ...

Read More

How and why does 'z'['toUpperCase']() in JavaScript work?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 326 Views

In JavaScript, the syntax 'z'['toUpperCase']() works because strings are objects, and you can access object methods using both dot notation and bracket notation. This alternative syntax calls the toUpperCase() method on the string 'z', converting it to uppercase. Syntax 'z'['toUpperCase']() // Returns 'Z' This is equivalent to the more common dot notation: 'z'.toUpperCase() // Returns 'Z' Why Does This Work? In JavaScript, there are two ways to access object properties and methods: Dot notation: object.property Bracket notation: object['property'] String literals like ...

Read More

How can I remove the decimal part of JavaScript number?

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

In this tutorial, we will learn to remove the decimal part of the number in JavaScript. While working with JavaScript, many times, developers need to play with the numbers stored in the database and needs to convert float and double numbers into the pure decimal or integer number. In this situation, developers can have multiple methods to truncate the decimal part of the number. We will see different approaches to overcome the above problem. Using the Math.trunc() method Using the Bitwise operators Using the Math.ceil() ...

Read More

How to set the style of the left border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 381 Views

In this tutorial, we shall learn how to set the style of the left border with JavaScript. To set the style of the left border in JavaScript, use the borderLeftStyle property. Set the style under this property that you want for the border i.e. solid, dashed, etc. Using the borderLeftStyle Property With this property, we can set or return the style of the left border of an element. Syntax object.style.borderLeftStyle = style; This syntax allows the required border style to be set to the element's style. Parameters ...

Read More

How to display the title of a document with JavaScript?

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

In JavaScript, you can display a document's title using two main approaches: the document.title property and the document.getElementsByTagName() method. This tutorial demonstrates both methods with practical examples. Using document.title Property The document.title property is the most straightforward way to access and display an HTML document's title. It directly returns the title as a string. Syntax document.title Example 1 This example shows how to display the document title by clicking a button: This is the title accessed from the document ...

Read More

How to convert Number to String in JavaScript?

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

This tutorial will teach us to convert the number to string in JavaScript. Changing the type of variable is called the type conversion of a variable. While coding, the programmer needs to deal with the different data types and might need to convert the variable's data type. Every programming language has different methods to convert one variable from one data type to another data type, and JavaScript also has some methods, which are explained below. Using the toString() Method Concatenating with an empty String Using ...

Read More

How do I display image in alert/confirm box in JavaScript?

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

In this tutorial, we will learn to display images in alert or confirm boxes in JavaScript. The standard alert() method displays a simple dialog box with text and an OK button, but it doesn't support images directly. To create more attractive and informative dialogs with images, we have two main approaches: Creating a custom alert box using vanilla JavaScript Using jQuery's dialog() method Method 1: Creating a Custom Alert Box This approach involves creating a custom HTML div that mimics an alert box and can contain images, styled ...

Read More
Showing 161–170 of 793 articles
« Prev 1 15 16 17 18 19 80 Next »
Advertisements