Javascript Articles

Page 289 of 534

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

Why in JavaScript, "if ('0' == false)" is equal to false whereas it gives true in "if(0)" statement?

mkotla
mkotla
Updated on 15-Mar-2026 2K+ Views

JavaScript's comparison behavior can be confusing when mixing different data types. Let's examine why '0' == false returns true while if(0) evaluates to false. Understanding '0' == false When using the loose equality operator ==, JavaScript performs type coercion following specific rules: console.log('0' == false); // true console.log(typeof '0'); // "string" console.log(typeof false); // "boolean" true string boolean The comparison follows this rule: If Type(y) is Boolean, return the result of the comparison x == ToNumber(y) Here's what happens step by step: ...

Read More

Rules to override Style Sheet Rule in CSS

varun
varun
Updated on 15-Mar-2026 3K+ Views

CSS follows a specific hierarchy when multiple styles are applied to the same element. Understanding the cascade and specificity rules helps you control which styles take precedence. CSS Cascade Priority Order CSS applies styles based on the following priority order, from highest to lowest: Inline styles - Styles applied directly to HTML elements using the style attribute Internal stylesheets - Styles defined within tags in the HTML document External stylesheets - Styles defined in separate CSS files linked to the HTML document Example: Style Override Hierarchy ...

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 to add comments in the style sheet blocks

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

You may need to put additional comments in your stylesheet blocks. Therefore, it is very easy to comment any part of the style sheet. You can simply put your comments inside /*...this is a comment in style sheet...*/. You can use /* ... */ to comment multi-line blocks in a similar way you do in C and C++ programming languages. Syntax /* Single-line comment */ /* Multi-line comment can span multiple lines */ Example: Adding Comments to CSS ...

Read More

How exactly does work?

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

The defer attribute tells the browser to download the script while parsing HTML but delay execution until the DOM is fully built. It only works with external scripts and maintains execution order. How defer Works HTML Parsing Script Download Script Execution 1. HTML parsing continues while script downloads 2. Script waits until DOM is complete 3. Scripts execute in document order ...

Read More

Which Measurement Unit should be used in CSS to set letter spacing

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 964 Views

To set letter spacing with CSS, use the em measurement unit for most cases, though other units like px and rem are also available depending on your needs. The em unit is a relative measurement based on the font size of the current element. Because an em unit equals the size of the current font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt. Why Use em for Letter Spacing? Using em units makes letter spacing responsive and proportional to the font size. When the font size changes, ...

Read More

How to Validate your Website Code?

Rahul Sharma
Rahul Sharma
Updated on 15-Mar-2026 357 Views

Website development involves writing code in HTML, CSS, JavaScript and your chosen platform. Your website may look correct and responsive, but it could have internal validation issues that affect SEO, accessibility, and browser compatibility. The W3C (World Wide Web Consortium) provides several free tools to validate your website code and ensure it meets web standards. HTML5 Validation Validator.nu is the recommended validator for modern HTML5 documents. It also validates ARIA, SVG 1.1, and MathML 2.0. This tool checks your complete document and identifies where the markup doesn't follow the specified doctype. ...

Read More

What is the difference between an acronym and abbr tags?

mkotla
mkotla
Updated on 15-Mar-2026 821 Views

In HTML, both acronym and abbreviation tags are used to mark shortened forms of words or phrases, but they have key differences in support and usage. An acronym is a word formed by taking the first letters of each word in a phrase (like "NASA" from "National Aeronautics and Space Administration"). An abbreviation is any shortened form of a word or phrase (like "Mr." for "Mister"). The Acronym Tag (Deprecated) The tag was used in older HTML versions to mark acronyms specifically. However, it is deprecated in HTML5 and should not be used in modern web ...

Read More

How to set font size using CSS Measurement Unit vmin?

mkotla
mkotla
Updated on 15-Mar-2026 256 Views

The vmin CSS unit sets font size based on the smaller dimension of the viewport (width or height). It's useful for creating responsive text that scales with screen size. What is vmin? The vmin unit represents 1% of the viewport's smaller dimension. If the viewport is 800px wide and 600px tall, 1vmin = 6px (1% of 600px). Syntax font-size: [number]vmin; Example vmin Font Size Example ...

Read More
Showing 2881–2890 of 5,340 articles
« Prev 1 287 288 289 290 291 534 Next »
Advertisements