Found 6710 Articles for Javascript

Map.entries() function in JavaScript

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

112 Views

The entries() function of Map object returns an iterator of the corresponding Map object and using this you can retrieve the key Value pairs of the map.SyntaxIts Syntax is as followsmapVar.entries()Example Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');       mapVar.set('2', 'JavaFX');       mapVar.set('3', 'HBase');       mapVar.set('4', 'Neo4j');       var it = mapVar.entries();       for(i=0; i

Map.delete() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:14:47

6K+ Views

The delete() function of Map object accepts a string representing the key of an element of a map and deletes from the current Map object. This function returns true if the specified key exists in the map object else it returns false.SyntaxIts Syntax is as followsmapVar.delete()Example Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');       mapVar.set('2', 'JavaFX');       mapVar.set('3', 'HBase');       mapVar.set('4', 'Neo4j');       var map = mapVar.delete('4');       document.write("Size of the map object: "+mapVar.size);   ... Read More

Map.clear() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:15:37

135 Views

The clear() function of Map object removes all elements from the current Map object.SyntaxIts Syntax is as followsmapVar.clear()Example Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');       mapVar.set('2', 'JavaFX');       mapVar.set('3', 'HBase');       mapVar.set('4', 'Neo4j');       var map = mapVar.clear();       document.write("Size of the map object: "+mapVar.size);     OutputSize of the map object: 0Example Live Demo    JavaScript Example           var mapVar = new Map();       ... Read More

Map.size property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:16:07

633 Views

The size property of Map object accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsmapVar.sizeExample Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');       mapVar.set('2', 'JavaFX');       mapVar.set('3', 'HBase');       mapVar.set('4', 'Neo4j');       document.write("Size of the map object: "+mapVar.size);     OutputSize of the map object: 4

Map.set() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:02:43

80 Views

The set() function of Map object adds or updates elements (key-value pairs) to a Map object.SyntaxIts Syntax is as followsmapVar.set()Example Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');       mapVar.set('2', 'JavaFX');       mapVar.set('3', 'HBase');       mapVar.set('4', 'Neo4j');       document.write(mapVar.has('3'));     Outputtrue

JSON. stringify( ) function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:03:07

265 Views

The stringify() function of a JSON object accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.stringify();Example Live Demo    JavaScript Example           var jsonSample = '{Tutorial: Java, Version:8}';       jsonObj = JSON.stringify(jsonSample);       document.write(jsonObj);     Output"{Tutorial: Java, Version:8}"

JSON.parse() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:03:33

198 Views

The JSON.parse() function accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.parse();Example Live Demo    JavaScript Example           var jsonSample = '{"Tutorial": "Java", "Version":8 }';       jsonObj = JSON.parse(jsonSample);       document.write("Tutorial Name: " + jsonObj.Tutorial);       document.write("");       document.write("Tutorial Version: " + jsonObj.Version);     OutputTutorial Name: Java Tutorial Version: 8

Date. toJSON() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 11:51:17

248 Views

The Date object is a data type built into the JavaScript language. Date objects are created with the new Date( ) as shown below.Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields of the object, using either local time or UTC (universal, or GMT) time.The toJSON() function of the date object returns the simplified extended ISO format of the date.SyntaxIts Syntax is as followsdateObj.toJSON();Example Live Demo    JavaScript Example       ... Read More

Date.toISOString() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 11:51:40

223 Views

The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below.Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields of the object, using either local time or UTC (universal, or GMT) time.The toISOString() function of the date object returns the simplified extended ISO format of the date.SyntaxIts Syntax is as followsdateObj.toISOString();Example Live Demo    JavaScript Example         ... Read More

Date.getUTCMilliseconds() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 11:36:41

107 Views

The Date object is a data type built into the JavaScript language. Date objects are created with the new Date( ) as shown below.Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields of the object, using either local time or UTC (universal, or GMT) time.The getUTCMilliseconds() function of the Date object returns the milliseconds in the given date according to the universal time.SyntaxIts Syntax is as followsdateObj.getUTCMilliseconds();Example Live Demo    JavaScript Example ... Read More

Advertisements