Javascript Articles

Page 301 of 534

What is the difference between "strict" and "non-strict" modes of JavaScript?

Abhinanda Shri
Abhinanda Shri
Updated on 15-Mar-2026 1K+ Views

The "use strict" is a directive introduced in JavaScript 1.8.5 that enables strict mode execution. In strict mode, JavaScript enforces stricter parsing and error handling, while non-strict mode (the default) is more permissive and allows certain problematic practices. Enabling Strict Mode To enable strict mode, add "use strict"; at the beginning of your script or function. For global scope, place it at the top of the script file. Check the console for errors (F12) ...

Read More

How can I set the color, style, and width of lines in a single property with CSS?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 171 Views

The border property allows you to specify color, style, and width of lines in one property. This shorthand property combines three individual border properties into a single declaration, making CSS more concise and easier to manage. Syntax border: width style color; Where: width - thickness of the border (e.g., 1px, 2px, thick) style - border style (solid, dashed, dotted, etc.) color - border color (name, hex, rgb, etc.) Example You can try to run the following code to specify the border property: ...

Read More

How to return a value from a JavaScript function?

Srinivas Gorla
Srinivas Gorla
Updated on 15-Mar-2026 3K+ Views

To return a value from a JavaScript function, use the return statement. The return statement sends a value back to the code that called the function and immediately exits the function. Syntax function functionName() { // function body return value; } Example: Basic Return Statement function concatenate(name, age) { var val = name + age; ...

Read More

Usage of border-left-style property in CSS

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 167 Views

The border-left-style property defines the style of an element's left border. It accepts various values like solid, dashed, dotted, double, and more to create different visual effects. Syntax border-left-style: value; Available Values Value Description none No border (default) solid Solid line dashed Series of dashes dotted Series of dots double Two parallel lines groove 3D grooved effect ridge 3D ridged effect Example: Different Border Styles ...

Read More

How does JavaScript 'return' statement work?

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

In this article, we will learn how to work with a return statement in JavaScript. A specific value from the function is returned to the function caller using the return statement. Whenever the return statement is run, the function will stop. The code that follows the return statement won't be available, due to which it is the last statement in a function. Using the return statement, we may return object types, including functions, objects, arrays, and primitive values like Boolean, integer, and string. By using the return statement, we can also return many items. To return several values ...

Read More

How to find the min/max element of an Array in JavaScript?

Abhishek
Abhishek
Updated on 15-Mar-2026 12K+ Views

In JavaScript, finding the minimum and maximum elements of an array is a common task. The minimum element is the smallest value in the array, while the maximum is the largest. This tutorial covers the most effective approaches to accomplish this. There are two main approaches to find min/max elements: Manual traversal using loops Using Math.min() and Math.max() methods Method 1: Manual Array Traversal This approach involves iterating through the entire array and comparing each element to keep track of the minimum and maximum values. It ...

Read More

Change the color of the bottom border with CSS

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

The border-bottom-color CSS property changes the color of an element's bottom border. This property only affects the color, not the width or style of the border. Syntax border-bottom-color: color; Parameters The property accepts standard CSS color values including hex codes, RGB values, HSL values, and named colors. Example p.demo { border: 4px solid black; ...

Read More

How to create a two dimensional array in JavaScript?

Nikitha N
Nikitha N
Updated on 15-Mar-2026 813 Views

A two-dimensional array has more than one dimension, such as myarray[0][0] for element one, myarray[0][1] for element two, etc. JavaScript doesn't have true 2D arrays, but you can create arrays of arrays to achieve the same functionality. Method 1: Using Array Constructor with Loop This method creates an empty 2D array and fills it row by row: var myarray = new Array(3); for (i = 0; ...

Read More

Change the color of top border with CSS

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

The border-top-color CSS property allows you to change the color of an element's top border independently of other borders. This property is useful when you want to create distinctive visual effects or highlight specific elements. Syntax border-top-color: color-value; The color value can be specified using color names, hex codes, RGB values, or HSL values. Example p.demo { border: 3px ...

Read More

How to remove an item from JavaScript array by value?

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

In this tutorial, we will learn to remove an item from a JavaScript array by value. An array is a data structure that can store a collection of elements. JavaScript provides several methods to manipulate arrays, including removing specific elements by their value rather than their index position. Following are the main methods to remove an item from an array by value: The Array filter() Method The Array splice() Method with indexOf() Using the Array filter() Method The filter() method creates a new array containing elements that ...

Read More
Showing 3001–3010 of 5,340 articles
« Prev 1 299 300 301 302 303 534 Next »
Advertisements