Javascript Articles

Page 83 of 534

JavaScript global Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 287 Views

The global property in JavaScript returns true or false depending upon if the ‘g’ modifier is set or not.Following is the code for JavaScript global property −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample, .result {       font-size: 18px;       font-weight: 500;    } JavaScript global Property Some random text inside a div CLICK HERE Click on the above button to check if the 'g' modifier is set or not    let sampleEle ...

Read More

JavaScript Immediately Invoked Function Expressions (IIFE)

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 184 Views

The JavaScript Immediately Invoked Function Expressions (IIFE) is a JavaScript function that executes immediately after it has been defined so there is no need to manually invoke IIFE.Following is the code for Immediately Invoked Function Expressions (IIFE) in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript Immediately Invoked Function Expressions (IIFE)    let sampleEle = document.querySelector(".sample");    (function () {       sampleEle.innerHTML ="This code is invoked immediately as soon as it is defined";    })(); Output

Read More

JavaScript JSON Arrays

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 321 Views

Arrays in JSON are similar to Arrays in JavaScript. JavaScript JSON arrays looks like this −let obj = {    name:'Rohan',    sports : ['cricket','Football','volleyball','hockey'] }Following is the code for JSON arrays in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JSON arrays CLICK HERE Click on the above button to access JSON array    let sampleEle = document.querySelector(".sample");    let obj = {       name:'Rohan',  sports : ['cricket','Football','volleyball','hockey']    }    document.querySelector(".Btn").addEventListener("click", () => {       obj.sports.forEach(item=>{          sampleEle.innerHTML += item + '';       })    }); OutputOn clicking the ‘CLICK HERE’ button −

Read More

JavaScript JSON HTML

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 304 Views

To generate HTML using JSON data, the code is as follows −Note − JSONPlaceholder is a fake Online REST API for Testing and PrototypingExample Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;       color: red;    } JSON arrays EMPLOYEE NAME CLICK HERE Click on the above button to fill the employee table    let sampleEle = document.querySelector(".employee");    document.querySelector(".Btn").addEventListener("click", () => {       fetch("https://jsonplaceholder.typicode.com/users")       .then((response) => response.json())       .then((result) => {          result.forEach((element) => {             sampleEle.innerHTML += "" + element.name;          });       });    }); OutputOn clicking the ‘CLICK HERE’ button −

Read More

JavaScript - know the value of GET parameters from URL

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 270 Views

To know the value of GET parameters from URL in JavaScript, the code is as follows −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;       color: red;    } GET parameters from URL https://www.google.com?imageSize=440&color=blue CLICK HERE Click on the above button to get the imageSize and color value from the above URL    let sampleEle = document.querySelector(".sample");    let resultEle = document.querySelector(".result");    var ...

Read More

JavaScript lastIndex Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 137 Views

The lastIndex property in JavaScript returns the index position when a match occurs and the next match then resumes from that position only. The lastIndex property works only if the ‘g’ modifier is set.Following is the code for the lastIndex property in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample,    .result {       font-size: 18px;       font-weight: 500;       color: red;    } JavaScript lastIndex Property The king bought an expensive ring. ...

Read More

JavaScript Let

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 204 Views

The JavaScript Let keyword introduced in 2015 allows us to define block scoped variables.Following is the code for declaring variable using Let keyword in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample{       font-size: 18px;       font-weight: 500;       color: red;    } JavaScript Let CLICK HERE Click on the above button to access the varible    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       ...

Read More

JavaScript Location protocol Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 229 Views

The JavaScript location protocol property returns the protocol used by the current URL.Following is the code for Location protocol Property in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample{       font-size: 18px;       font-weight: 500;       color: red;    } Location protocol Property CLICK HERE Click on the above button to get the location protocol    let sampleEle = document.querySelector(".sample");    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.innerHTML = 'The protocol used by the website = ' + location.protocol;    }); OutputOn clicking the “CLICK HERE” button −

Read More

JavaScript multiline Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 197 Views

The JavaScript multiline property returns true or false depending upon if the ‘m’ modifier has been set or not.Following is the code for the JavaScript multiline property −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample, .result {       font-size: 18px;       font-weight: 500;       color: red;    } JavaScript Math Object The king bought the ring CLICK HERE Click on the above button to see if m modifier has been set or ...

Read More

JavaScript Numbers example

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 179 Views

Following is an example for numbers in JavaScript −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample{       font-size: 18px;       font-weight: 500;       color: red;    } JavaScript Numbers CLICK HERE Click on the above button to see numbers in JavaScript    let sampleEle = document.querySelector(".sample");    let a =22;    let b = 1.523;    let c = 99;    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.innerHTML = 'a = ' + a + '';       sampleEle.innerHTML += 'b =' + b + '';       sampleEle.innerHTML += 'c = ' + c + '';       sampleEle.innerHTML += 'a + c = ' + (a+c) + '';    }); OutputOn clicking the ‘CLICK HERE’ button −

Read More
Showing 821–830 of 5,338 articles
« Prev 1 81 82 83 84 85 534 Next »
Advertisements