Array.entries() Method in JavaScript

AmitDiwan
Updated on 08-May-2020 12:22:02

184 Views

The JavaScript array.entries() method returns key/value pairs as an array iterator object.Following is the code for the array.entries() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript Array some() CLICK HERE Click on the above button to see array elements as key value pairs    let fillEle = document.querySelector(".sample");    let arr = ["cow", "bull", "lion", "tiger", "sheep"];    fillEle.innerHTML = arr;    var entries = arr.entries();    document.querySelector(".Btn").addEventListener("click", () => {       fillEle.innerHTML = "";       for (let x of entries) fillEle.innerHTML += x + "";    }); OutputOn clicking the “CLICK HERE” button −

JavaScript Symbol toString Method

AmitDiwan
Updated on 08-May-2020 12:03:55

75 Views

The JavaScript symbol.toString() returns the string representation of the specified symbol object.Following is the code for Symbol.toString() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    div {       font-size: 20px;       font-weight: 500;    } JavaScript symbol.toString() method CLICK HERE Click on the above button to get the string representation for symbol    let fillEle = document.querySelector(".sample");    const symbol = Symbol.for("HELLO");    const symbol1 = Symbol.for("NEW");    const symbol2 = Symbol.for(711);    document.querySelector(".Btn").addEventListener("click", () => {       fillEle.innerHTML += symbol.toString() + "";       fillEle.innerHTML += symbol1.toString() + "";       fillEle.innerHTML += symbol2.toString() + "";    }); OutputOn clicking the “CLICK HERE” button −

JavaScript Symbol keyFor Function

AmitDiwan
Updated on 08-May-2020 11:57:09

92 Views

The JavaScript Symbol.iskeyFor() is used for finding the key that is associated with a given symbol. The key is retrieved from the global symbol registry.Following is the code for Symbol.keyFor() function −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    div {       font-size: 20px;       font-weight: 500;    } JavaScript Symbol.keyFor() function CLICK HERE Click on the above button to find the keys for the symbol    let fillEle = document.querySelector(".sample");    const ... Read More

JavaScript Symbol.isConcatSpreadable

AmitDiwan
Updated on 08-May-2020 11:52:36

94 Views

The Symbol.isConcatSpreadable symbol is used to specify if a nested array should be flattened to its individual array elements or not when using the Array.prototype.concat() method.Following is the code for Symbol.isConcatSpreadable symbol −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    div {       font-size: 20px;       font-weight: 500;    }    .result {       color: red;    } JavaScript Symbol.isConcatSpreadable symbol CLICK HERE Click on the above button to concat the both array ... Read More

JavaScript Array Keys Method

AmitDiwan
Updated on 08-May-2020 11:49:07

158 Views

The JavaScript array.keys() creates an array iterator object having only the keys of an arrayFollowing is the code for the array.keys() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript array keys() CLICK HERE Click on the above button to see the keys of the array    let fillEle = document.querySelector(".sample");    let arr = ["H", "E", "L", "L", "O"];    fillEle.innerHTML = arr;    arr = arr.keys();    document.querySelector(".Btn").addEventListener("click", () => {       fillEle.innerHTML = "";       for (let x of arr) {          fillEle.innerHTML += x + "";       }    }); OutputOn clicking the “CLICK HERE” button −

JavaScript Array Prototype Constructor

AmitDiwan
Updated on 08-May-2020 11:37:41

232 Views

The JavaScript Array prototype constructor is for adding new methods and properties to array object. These properties and methods will be available for each array.Following is the code for the array prototype constructor −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript Array prototype Constructor CLICK HERE Click on the above button to convert the string to upper and lowercase alternatively    Array.prototype.upperLower ... Read More

JavaScript Generator

AmitDiwan
Updated on 08-May-2020 11:30:08

360 Views

A generator function uses the yield keyword to generate results and maintain its state even after returning so that the next time when it is called it can resume immediately from the last yield run. Each call to the generator function will send a value back to the caller.Following is the code for the Generator function in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript ... Read More

Best Tutorial Sites to Learn HTML

Nikitha N
Updated on 08-May-2020 11:13:35

189 Views

HTML stands for Hyper Text Markup Language, which is the most widely used language on Web to develop web pages. HTML was created by Berners-Lee in late 1991 but "HTML 2.0" was the first standard HTML specification which was published in 1995. HTML 4.01 was a major version of HTML and it was published in late 1999. However, HTML 4.01 version is widely used but currently we are having HTML-5 version, which is an extension to HTML 4.01, and this version published in 2012.To learn HTML, refer HTML tutorial. It explains the below given HTML concepts perfectly:HTML Basic TagsElementsAttributesHTML Phrase ... Read More

JavaScript DataView

AmitDiwan
Updated on 08-May-2020 11:09:35

188 Views

The JavaScript DataView allows us for reading and writing in multiple number types in binary ArrayBuffer by providing a low level interface. We cannot manipulate ArrayBuffer directly without using DataView().Following is the code for implementing JavaScript DataView −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 20px;       font-weight: 500;    } JavaScript DataView() CLICK HERE Click on the above button to change the array buffer contents using DataView()   ... Read More

Difference Between Height and Line Height

Alex Onsman
Updated on 08-May-2020 11:06:32

3K+ Views

Height is the vertical measurement of the container, for example, height of a div.Line-height is a CSS property to specify the line height i.e. the distance from the top of the first line of text to the top of the second. It is the space between the lines of two paragraphs.ExampleYou can try to run the following code to learn the difference between height and line height:Live Demo                    .height {             height: 20px;          }          .lheight ... Read More

Advertisements