Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 301 of 534
What is the difference between "strict" and "non-strict" modes of JavaScript?
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 MoreHow can I set the color, style, and width of lines in a single property with CSS?
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 MoreHow to return a value from a JavaScript function?
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 MoreUsage of border-left-style property in CSS
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 MoreHow does JavaScript 'return' statement work?
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 MoreHow to find the min/max element of an Array in JavaScript?
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 MoreChange the color of the bottom border with CSS
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 MoreHow to create a two dimensional array in JavaScript?
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 MoreChange the color of top border with CSS
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 MoreHow to remove an item from JavaScript array by value?
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