Front End Technology Articles - Page 593 of 860

Map.keys() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:09:19

75 Views

The keys() function of Map object is similar to entries but, it returns an iterator object containing the keys of a map object.SyntaxIts Syntax is as followsMap.keys()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.keys();       for(i=0; i

Map.has() function in JavaScript

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

277 Views

The has() function of Map object accepts a key in string format and returns a boolean value, if specified key exists it returns true else returns false.SyntaxIts Syntax is as followsmapVar.has()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'));     OutputtrueExample Live Demo    JavaScript Example           var mapVar = new Map();       mapVar.set('1', 'Java');     ... Read More

Map.get() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 12:12:01

89 Views

The get() function of Map object accepts a key in string format and returns its respective value.SyntaxIts Syntax is as followsmapVar.get()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.get('3'));     OutputHBase

Map.forEach() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 12:12:40

100 Views

The forEach() 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.forEach()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');       function show(values) {          document.write(values);          document.write("");       }       mapVar.forEach(show);     OutputJava JavaFX HBase Neo4j

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

159 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

644 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

102 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

283 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

208 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

Advertisements