Javascript Articles

Page 402 of 534

parseFloat() function in JavaScript

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

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 More

isFinite() function in JavaScript

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

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 More

encodeURIComponent() function in JavaScript

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

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 More

decodeURIComponent() function in JavaScript

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

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 More

TypedArray.BYTES_PER_ELEMENT property in JavaScript

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

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 More

TypedArray.name property in JavaScript

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

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 More

Write a program to find the index of particular element in an array in javascript?

Vivek Verma
Vivek Verma
Updated on 15-Mar-2026 1K+ Views

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 More

Write the main difference between '==' and '===' operators in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 239 Views

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 More

what is the main difference between '=' and '==' operators in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 307 Views

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 More

Explain about logical not(!) operator in detail with example in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 201 Views

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
Showing 4011–4020 of 5,340 articles
« Prev 1 400 401 402 403 404 534 Next »
Advertisements