
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

149 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 −

222 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

352 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

1K+ Views
The findIndex() function in JavaScript returns the index of the first element value that satisfy a given condition in an array.Following is the code for the array find() function −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .findIndex { font-size: 20px; font-weight: 500; } JavaScript Array FindIndex() example CLICK HERE Click on the above button to get the index of lion in the array function findLion(animal) { return ... Read More

195 Views
The cursor property is sets or returns the cursor type that will be displayed for the cursor property.Following is the code for implementing JavaScript Cursor property −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } JavaScript Cursor property Hover the mouse over the above paragraph after clicking the below button Change Cursor let sampleEle = document.querySelector(".sample"); document.querySelector(".Btn").addEventListener("click", () => { sampleEle.style.cursor = "crosshair"; }); OutputOn clicking the “Change Cursor” button −

148 Views
The JavaScript Array.isArray() method is used to check if an object is an array or not.Following is the code for the Array.isArray() method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript Array isArray() CLICK HERE Click on the above button to check if the above object is an array or not let fillEle = document.querySelector(".sample"); let arr = ["cow", "bull", ... Read More

144 Views
The JavaScript array.includes() method is used to check if an array contains a given element or not.Following is the code for the array.includes() method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 20px; font-weight: 500; } JavaScript Array includes() CLICK HERE Click on the above button to check if the array contains lion element or not let fillEle = document.querySelector(".sample"); let arr = ["cow", "bull", "lion", "tiger", "sheep"]; fillEle.innerHTML = arr; document.querySelector(".Btn").addEventListener("click", () => { fillEle.innerHTML = "Lion is present in array: " + arr.includes("lion"); }); OutputOn clicking the “CLICK HERE” button −

521 Views
The JavaScript focus() method is used for focusing on an element only if the element can be focused.Following is the code for the JavaScript Focus() Method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 18px; font-weight: 500; } JavaScript focus() CLICK HERE Click on the above buttons to focus the input field let sampleEle = document.querySelector(".sample"); document.querySelector(".Btn").addEventListener("click", () => { sampleEle.focus(); }); OutputOn clicking the “CLICK HERE” button −

217 Views
The exec() method executes the search for match and if the matched text is found in the specified string then it is returned otherwise null is returned.Following is the code for the JavaScript exec() Method −Example Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 18px; font-weight: 500; } JavaScript exec() Lorem ipsum dolor, sit amet consectetur adipisicing. CLICK HERE Click on the above buttons to execute regex ... Read More

716 Views
The escape() function in JavaScript is used for encoding a string. It is deprecated in JavaScript 1.5.Following is the code for the JavaScript escape()Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample { font-size: 18px; font-weight: 500; } JavaScript escape() CLICK HERE Click on the above buttons to encode the URI let sampleEle = document.querySelector(".sample"); let url = "https://www.google.com/images?size=420px&name=8s1f.jpg"; document.querySelector(".Btn").addEventListener("click", () => { sampleEle.innerHTML = escape(url); }); OutputOn clicking the “CLICK HERE” button −