
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

227 Views
To know the value of GET parameters from URL in JavaScript, the code is as follows −Example Live Demo 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"); ... Read More

406 Views
In JavaScript, the JSON.stringify() method is a useful tool that converts JavaScript objects into JSON strings. This is important when dealing with APIs, storing data, or transferring information between different systems. Knowing how to use JSON.stringify() helps developers manage data transformations in their applications. In this article, we will look at how JSON.stringify() works, its syntax, the parameters it uses, and some examples of how to use it well. The basic syntax for JSON.stringify() is as follows: JSON.stringify(obj, replacer, space) Let's understand the parameters used in JSON.stringify() syntax: obj: The JavaScript object to be ... Read More

389 Views
The JSON parse() method is used for parsing a JSON string and then creating a JavaScript object from it.Following is the code for JSON parse() method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 18px; font-weight: 500; color: red; } JSON parse() Method {"name":"Rohan", "sports":["Cricket", "Football"], "country":"India"} CLICK HERE Click on the above button to parse the above JSON string let ... Read More

259 Views
To generate HTML using JSON data, the code is as follows −Note − JSONPlaceholder is a fake Online REST API for Testing and PrototypingExample Live Demo 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 −

295 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 Live Demo 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 −

134 Views
The JavaScript infinity property displays infinity if the upper limit of the floating-point number is exceed and − infinity if the lower limit of the floating point number has has been exceeded.Following is the code for JavaScript infinity property −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .num { font-size: 18px; font-weight: 500; } JavaScript Infinity property 1.797693134862315E+10308 -1.797693134862315E+10308 CLICK HERE Click on the above button to add and subtract the above floating ... Read More

145 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 Live Demo 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

252 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 Live Demo 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 ... Read More

164 Views
The getTime() method in JavaScript returns the number of milliseconds elapsed since 1st January 1970.Following is the code for getTime() function −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 18px; font-weight: 500; } JavaScript getTime() Method CLICK HERE Click on the above button to get the seconds elapsed since January 1st 1970 let sampleEle = document.querySelector(".sample"); let date = new Date(); document.querySelector(".Btn").addEventListener("click", () => { sampleEle.innerHTML = "Seconds elapsed since 01/01/1970 = " + date.getTime(); }); OutputOn clicking the “CLICK HERE” button −

160 Views
In JavaScript, the Object.getPrototypeOf() method is used to get the prototype of a specified object. This method is used to check prototype of user created object and is often used to compare if the two given objects have the same prototype or not. This method is important for JavaScript's prototype-based inheritance, helping developers understand and work with the prototype chain of objects. In this article, we will look at into the syntax, usage, and examples of getPrototypeOf(). Syntax of the Object.getPrototypeOf() Function The basic syntax for Object.getPrototypeOf() is as follows: Object.getPrototypeOf(obj) obj(parameter): The object whose prototype is to be ... Read More