Found 448 Articles for Programming Scripts

isFinite() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:07:19

35 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 Number object.SyntaxIts Syntax is as followsisFinite(5655);Example Live Demo    JavaScript Example           var result1 = Math.min();       document.write(isFinite(result1));       document.write("");       var result2 = Number.isFinite(100/0);       document.write(result2);       document.write("");       var result3 = Math.max(25, 36, 862);       document.write(isFinite(result3));     Outputfalse false true

isNAN() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:08:12

387 Views

The isNaN() function accepts a value and determines whether the given value is a number or not.If so, this method returns true else it returns false. You can also call this method using Number object.SyntaxIts Syntax is as followsisNAN(5655);Example Live Demo    JavaScript Example           var result1 = parseFloat("Ef00A.D3");       document.write(isNaN(result1));       document.write('');       var result2 = Math.log("welcome");       document.write(isNaN(result2));       document.write('');       var result3 = Math.log(1254);       document.write(isNaN(result3));     Outputtrue true false

parseFloat() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:55:38

84 Views

The parseFloat() function accepts two parameters one is a string representing a number and another is a number representing the radix and returns an integer of the given radix.SyntaxIts Syntax is as followsnum.parseFloat('4524', 8);Example Live Demo    JavaScript Example           var result1 = parseFloat(Math.PI);       document.write("Result: "+result1);       document.write('');       var result2 = parseFloat("245.12@welcome");       document.write("Result: "+result2);       document.write('');       var result3 = parseFloat("11111100.010");       document.write("Result: "+result3);     OutputResult: 3.141592653589793 Result: 245.12 Result: 11111100.01

parseInt() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:56:34

434 Views

The parseInt() function accepts two parameters one is a string representing a number and another is a number representing the radix and returns an integer of the given radix.SyntaxIts Syntax is as followsnum.parseInt('4524', 8);Example Live Demo    JavaScript Example           var result = parseInt('4524', 8);       document.write("Result: " + result);     OutputResult: 2388Example Live Demo    JavaScript Example           var result1 = parseInt('4524', 8);       document.write("Result: " + result1);       document.write("");       var result2 = parseInt('4524', 10);       document.write("Result: " + result2);       document.write("");       var result3 = parseInt('4524', 16);       document.write("Result: " + result3);     OutputResult: 2388 Result: 4524 Result: 17700

SharedArrayBuffer.byteLength Property in JavaScript

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

55 Views

The byteLength property of the SharedArrayBuffer returns an unsigned, 32-bit integer that specifies the size/length of a SharedArrayBuffer. Syntax Its Syntax is as follows sharedArrayBuffer.byteLength Example Live Demo JavaScript Example var sharedArrayBuffer = new SharedArrayBuffer(8); var result = sharedArrayBuffer.byteLength; document.write("length of the shared array buffer is: " + result); Output length of the shared array buffer is: 8

Set.values() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 13:00:59

740 Views

The values() function of the Set returns an iterator object which holds the values of the current Set object.The next() method returns the next element in the iterator object.SyntaxIts Syntax is as followssetObj.values()Example Live Demo    JavaScript Example           const setObj = new Set();       setObj.add('Apples');       setObj.add('Oranges');       setObj.add('Bananas');       setObj.add('Grapes');       var valuesObject = setObj.values();       for(i=0; i

Set.has() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 13:03:11

176 Views

The has() function of the Set accepts a value and verifies whether the current object contains the specified value. If so, this function returns the boolean value true else, it returns false.SyntaxIts Syntax is as followssetObj.has()Example Live Demo    JavaScript Example           const setObj = new Set();       setObj.add('Java');       setObj.add('JavaFX');       setObj.add('JavaScript');       setObj.add('HBase');       document.write("Contents of the Set: ");       document.write("");       for (let item of setObj) {          document.write(item);          document.write(""); ... Read More

Set.forEach() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:50:08

805 Views

The forEach() function of the Set object accepts the name of a particular function and runs that function for every value in the current set. For Example, if you have written a function to print a value, if you use forEach() function it prints the value of every element in the set.SyntaxIts Syntax is as followssetObj.forEach()Example Live Demo    JavaScript Example           function sampleFunction(value){          document.writeln(value+", ");       }       const setObj1 = new Set();       setObj1.add('Java');       setObj1.add('JavaFX');       setObj1.add('JavaScript'); ... Read More

Set.entries() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:50:45

97 Views

The entries() function of the Set returns an iterator object which holds the contents of the current Set. This iterator object returns a pair of values for each entry just like map (key and value). But here, instead of both key and value it returns the element of the set in the particular position.SyntaxIts Syntax is as followssetObj.entries()Example Live Demo    JavaScript Example           const setObj = new Set();       setObj.add('Java');       setObj.add('JavaFX');       setObj.add('JavaScript');       setObj.add('HBase');       const entries = setObj.entries();     ... Read More

Set.delete() function in JavaScript

Samual Sam
Updated on 24-Nov-2023 01:01:23

1K+ Views

The delete() function of the Set object accepts a value and removes it from the current Set object. Syntax Its Syntax is as follows setObj.delete() Example    JavaScript Example           const setObj = new Set();       setObj.add('Java');       setObj.add('JavaFX');       setObj.add('JavaScript');       setObj.add('HBase');       document.write("Contents of the Set before deletion:");       document.write("");       for (let item of setObj) {          document.write(item);          document.write("");       }       ... Read More

Advertisements