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 402 of 534
parseFloat() function in JavaScript
The parseFloat() function parses a string and returns a floating-point number. It reads the string from left to right until it encounters a character that cannot be part of a number. Syntax parseFloat(string) Parameters The function takes only one parameter: string - The string to be parsed into a floating-point number Return Value Returns a floating-point number parsed from the string. If the first character cannot be converted to a number, it returns NaN. Example: Basic Usage JavaScript parseFloat Example ...
Read MoreisFinite() function in JavaScript
The isFinite() function accepts a value and determines whether the given value is a finite number or not. If so, this method returns true, else it returns false. You can also invoke this method using the Number object as Number.isFinite(). Syntax isFinite(value) Number.isFinite(value) Parameters value: The value to be tested for finiteness. Return Value Returns true if the value is a finite number, false otherwise. Example: Basic Usage JavaScript Example ...
Read MoreencodeURIComponent() function in JavaScript
The encodeURIComponent() function accepts a string representing a URI component and encodes it by replacing special characters with percent-encoded sequences. This is essential for safely passing data in URLs. Syntax encodeURIComponent(uriComponent) Parameters uriComponent: A string to be encoded as a URI component. Return Value Returns a new string representing the encoded URI component with special characters replaced by percent-encoded sequences. Example 1: Basic Usage JavaScript Example var url = 'http://www.tutorialspoint.com/'; ...
Read MoredecodeURIComponent() function in JavaScript
The decodeURIComponent() function accepts a string value representing an encoded URI (Uniform Resource Identifier), decodes it, and returns the result. It reverses the encoding done by encodeURIComponent(). Syntax decodeURIComponent(encodedURI) Parameters encodedURI: A string representing an encoded URI component that you want to decode. Return Value Returns a new string representing the decoded version of the given encoded URI component. Example JavaScript Example var encodedData = encodeURIComponent('http://www.qries.com/?x=шеллы'); ...
Read MoreTypedArray.BYTES_PER_ELEMENT property in JavaScript
The BYTES_PER_ELEMENT property of TypedArrays represents the number of bytes each element occupies in memory. This static property helps determine the memory size of different typed array types. Syntax TypedArray.BYTES_PER_ELEMENT Where TypedArray can be any typed array constructor like Int8Array, Float32Array, etc. Example: Different TypedArray Sizes JavaScript Example var sizeOfFloat32Array = Float32Array.BYTES_PER_ELEMENT; document.write("Size of Float32Array element: " + sizeOfFloat32Array + " bytes"); ...
Read MoreTypedArray.name property in JavaScript
The name property of TypedArray constructors returns a string representing the name of the typed array type. This property is available on all TypedArray constructors like Int8Array, Uint8Array, Float32Array, etc. Syntax TypedArrayConstructor.name Where TypedArrayConstructor is one of: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, or BigInt64Array, BigUint64Array. Return Value Returns a string containing the name of the TypedArray constructor. Example TypedArray name Property var nameOfarray1 = Float32Array.name; ...
Read MoreWrite a program to find the index of particular element in an array in javascript?
Finding the index of a particular element in an array is a common task in JavaScript. An array is an object that contains multiple values in a sequential order, with each element having a specific index position. 22 45 67 89 12 0 1 2 3 4 Array Elements Index ...
Read MoreWrite the main difference between '==' and '===' operators in javascript?
The main difference between == and === operators in JavaScript is that == performs type coercion (converts types before comparing), while === performs strict comparison without any type conversion. The == Operator (Loose Equality) The == operator compares values after converting them to the same type if needed. This can lead to unexpected results. Example var x = 5; var y = "5"; var z = 6; document.getElementById("loose").innerHTML = (x == y) + "" + (x == z); Output true false Notice ...
Read Morewhat is the main difference between '=' and '==' operators in javascript?
In JavaScript, the = operator is used for assignment, while the == operator is used for equality comparison. Understanding this difference is fundamental to writing correct JavaScript code. The Assignment Operator (=) The = operator assigns a value from the right side to the variable on the left side. It does not compare values. var x = 5; // Assigns 5 to variable x var y = "6"; // Assigns string "6" to variable y var z = x; ...
Read MoreExplain about logical not(!) operator in detail with example in javascript?
The logical NOT operator (!) is a unary operator that inverts boolean values. It returns true for falsy values and false for truthy values. Syntax !expression How It Works The NOT operator first converts the operand to a boolean value, then returns its opposite: If the operand is truthy, it returns false If the operand is falsy, it returns true Example with Boolean Values document.getElementById("boolean-demo").innerHTML = "!true = " + !true ...
Read More