- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 9291 Articles for Object Oriented Programming
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
100 Views
The Array.prototype.find() method returns the first element value that satisfy a given condition in an array.Following is the code for the Array.prototype.find() method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .find { font-size: 20px; font-weight: 500; } JavaScript Array Find() example CLICK HERE Click on the above button to find lion among the animals function findLion(animal) { return animal === "lion"; } let fillEle = ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
230 Views
The error object is basically thrown by the JavaScript interpreter when a script error occurs. This error object can also be thrown as exception for user defined exceptions. The two javaScript error object properties are −PropertyDescriptionnameIt sets or returns the name of the error.messageIt sets or returns the error message as stringFollowing is the code for error object in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
244 Views
Block scope is an area between two { curly braces } which can be between loops, if condition or switch statement. The let and const introduced in ES2015 allow us to create block scoped variables that can be accessed only inside those block.Following is the code showing block scoping in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result{ font-size: 20px; font-weight: 500; } Block scoping in JavaScript CLICK HERE Click on ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
95 Views
Following is the code on invoking a function as a function and method −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result{ font-size: 20px; font-weight: 500; } Invoke a function as function and method CLICK HERE Click on the above button to invoke function as function and method let resEle = document.querySelector(".result"); function add(a, b){ return a+b; } let obj = { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
830 Views
Function parameters are the names of variables present in the function definition. Function arguments are the real values that are passed to the function and received by them.Following is the code showing parameters and arguments in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample{ font-size: 20px; font-weight: 500; } Function parameters and arguments CLICK HERE Click on the above button to pass the above values as arguments to ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
467 Views
The encodeURI() function encodes the complete URI including special characters except except (, / ? : @ & = + $ #) characters.The decodeURI() function decodes the URI generated by the encodeURI() function.Following is the code for encodeURI() and decodeURI() functions in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .encode, .decode { font-size: 18px; font-weight: 500; } encodeURI() and decodeURI() function in JavaScript ENCODE URI DECODE URI Click on ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
You can use the concept of focus(). Following is the JavaScript code −Example Live Demo Document TEXT BOX FOR FOCUS click me to get the tab on focus document.getElementById('focusButton').addEventListener('click', function() { document.querySelectorAll('.TEXT_FOCUS')[0].focus(); }); To run the above program, save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VS code editor.OutputWhen you click the button, the focus will be on a particular element. The snapshot is as follows −
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
250 Views
To highlight a text, every time page loads, use the for loop and the concept of −Example Live Demo Document .yellow { color: yellow; } .blue { color: blue; } My yellow Words, your blue Words var ids = document.getElementById("pageLoads"); var loadColorWords = ids.innerHTML.split(" "); for(var i = 0; i < loadColorWords.length; i++) { if(loadColorWords[i] == "blue") { loadColorWords[i] = "" + loadColorWords[i] + ""; } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
113 Views
The innerWidth property returns the width of the window content area and the innerHeight property returns the width of the window content area.Following is the code for window innerWidth and innerHeight properties in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result{ font-size: 20px; font-weight: 500; } Window innerWidth and innerHeight Properties CLICK HERE Click on the above button get the innerWidth and innerHeight of the window. let ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
5K+ Views
Type casting means conversion of one data type to another explicitly. In JavaScript some of the most common methods to convert a datatype to either string using String(), to boolean using Boolean(), or to number using Number().Following is the code for type casting in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 20px; font-weight: 500; } Type casting in JavaScript. 44 CLICK HERE Click on the above button ... Read More