Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 21 of 80

Set whether the flexible items should wrap or not with JavaScript?

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

In this tutorial, we will learn how to control whether flexible items should wrap or not using JavaScript's flexWrap property. The flexWrap property determines if flex items should wrap to new lines when there isn't enough space in the container. This is essential for creating responsive layouts. Using the Style flexWrap Property The flexWrap property defines whether flex items wrap within their container. The container must have display: flex for this property to work. The default value is nowrap. Syntax object.style.flexWrap = "nowrap|wrap|wrap-reverse|initial|inherit" Values nowrap − Items will not wrap ...

Read More

How to convert Binary to Decimal in JavaScript?

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

In this tutorial, we will learn to convert binary to decimal in JavaScript. A binary number is a string of '0' and '1' digits, representing numbers in base 2 format used in digital electronics. Here are two different methods to convert binary numbers to decimal: Using the parseInt() Method The parseInt() method can extract numbers from strings and accepts a base parameter, making it perfect for binary conversion. Syntax let binary = "0101"; let decimal = parseInt(binary, 2); Parameters binary − The binary number as a string base − The ...

Read More

How to work with document.head in JavaScript?

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

In this tutorial, let us discuss how to work with the document's head in JavaScript. The document.head property is a DOM Level 3 read-only feature that returns the element of the current document. This property provides access to metadata elements like title, meta tags, stylesheets, and scripts. The head tag contains document metadata including title, keywords, description, and stylesheets. Every HTML document should have a head section, though the opening and closing tags are optional in HTML. Syntax let headElement = document.head; Return Value The document.head property returns the HTML ...

Read More

How to work with document.forms in JavaScript?

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

In this tutorial, let us discuss how to work with document.forms in JavaScript. The document.forms property returns a collection of all form elements in the document. This property is read-only and provides access to form elements, their properties, and methods. It's part of the DOM Level 1 specification. Syntax var forms = document.forms; let formLen = forms.length; let formId = forms[0].id || forms.item(0).id; let formItemId = forms[0].elements[0].id; let formItemVal = forms[0].elements[0].value; let formData = forms.namedItem("testForm").innerHTML; The above syntax returns the collection of forms, total number of forms, form ID, form element ID, form element ...

Read More

How to print object array in JavaScript?

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

In this tutorial, we will learn how to print object arrays in JavaScript. An array of objects is a collection that stores multiple objects with similar structure in a single variable. Each object can contain multiple properties, making it useful for storing complex data like user information, product details, or any structured data. Let's explore different methods to print arrays of objects in JavaScript. Using JSON.stringify() Method The JSON.stringify() method converts JavaScript objects into JSON strings, making it perfect for displaying arrays of objects in a readable format. Syntax JSON.stringify(value, replacer, space) ...

Read More

How to work with document.links in JavaScript?

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

In JavaScript, the document.links property provides access to all anchor () and area () elements that have an href attribute. This DOM property returns a live HTMLCollection of clickable links in the document. Syntax let links = document.links; Properties The document.links collection provides one main property: length − Returns the number of links in the collection. Working with document.links Properties The example below demonstrates how to access link properties. Note that only elements with href attributes are included in the collection. Working ...

Read More

How to print a triangle formed of '#' using JavaScript?

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

In this tutorial, we will learn to print a triangle formed of '#' using JavaScript. You need to use nested loops to print a triangle formed of '#' in JavaScript. The outer loop controls the number of rows, while the inner loop controls how many '#' symbols to print in each row. Nested loops are loops that contain another loop inside them. We'll explore two approaches using different types of loops in JavaScript: for loop while loop Using for Loop to Print a Triangle The for loop ...

Read More

How can I get a JavaScript stack trace when I throw an exception?

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

This tutorial teaches us to get a JavaScript stack trace when we throw an exception. Usually, the developer uses the stack trace to identify the errors while executing the program's code. However, we use the stack trace to debug the program. Using the stack trace, we can get knowledge of any kind of exceptions, such as constructor error, naming error, etc., in our program, and we can correct them. Before we approach analyzing the error using the stack trace, we should know how to stack trace works. How does the call stack trace work? The stack ...

Read More

How do you access the matched groups in a JavaScript regular expression?

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

This tutorial will teach us to access the matched groups in JavaScript regular expression. The regular expression is the sequence of the character, also called the RegEx, and it is useful to match specific patterns in the string. There can be more than one match for the specific pattern in the string. To get the occurrence of all matches, we have explained the different methods below in this tutorial. We will also see the various usage of the regular expression in this article. Use the 'g' flag while creating the Regex When we add 'g' as ...

Read More

How to manipulate JavaScript's Date object?

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

JavaScript's Date object provides powerful methods to manipulate dates and times. You can use getter methods to retrieve date components and setter methods to modify them. Understanding these methods is essential for effective date manipulation in JavaScript applications. Once a Date object is created, numerous methods allow you to operate on it. Most methods let you get and set the year, month, day, hour, minute, second, and millisecond fields using either local time or UTC (universal, or GMT) time. Common Date Methods Here are the key methods used with Date objects: Sr.No Methods ...

Read More
Showing 201–210 of 793 articles
« Prev 1 19 20 21 22 23 80 Next »
Advertisements