- 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)
452 Views
The JavaScript regular expression modifiers are optional part of a regular expression and allow us to perform case insensitive and global searchers. The modifiers can also be combined together.Following are the modifiers −ModifierDescriptiongIt enables global matching and returns all the matched results instead of stopping at first matchiIt enables case insensitive matchingmIt enables multiline matchingExampleFollowing is the code for strict comparison in JavaScript switch statement − Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
349 Views
The JavaScript switch statement only uses strict comparison (===) and doesn’t converts type if matches are not found using strict comparison and will immediately execute the default statement.Following is the code for strict comparison in JavaScript switch statement −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } JavaScript Switch statement strict comparison Enter day 1-7 CHECK Click on the above button to check if switch ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
188 Views
Following is the code to implement common code blocks in JavaScript switch statement −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } JavaScript Switch statement Enter day 1-7 CHECK Click on the above button to check which day it is let dayVal = document.querySelector(".day"); let resEle = document.querySelector(".result"); document.querySelector(".Btn").addEventListener("click", () => { switch (parseInt(dayVal.value)) { ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
73 Views
The JavaScript Array.isArray() method is used to verify if a JavaScript object is an array or not based on the Boolean value returned by it.Following is the code to verify if JavaScript object is an array −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 20px; font-weight: 500; } Verify if a JavaScript object is array CLICK HERE Click on the above button to verify if the above ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
95 Views
Following is the code to set the day of a date in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 20px; font-weight: 500; } Setting day of the date in JavaScript CLICK HERE Click on the above button to change the day of the above date object let sampleEle = document.querySelector('.sample'); let resEle = document.querySelector(".result"); let dateObj = new Date(); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
4K+ Views
Associative arrays are basically objects in JavaScript where indexes are replaced by user defined keys. They do not have a length property like normal array and cannot be traversed using normal for loop.Following is the code for associative arrays in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } Associative array in JavaScript CLICK HERE Click on the above button to create a associative array ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
153 Views
Following is the code for creating a JavaScript array with new keyword −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } Creating array with new keyword CLICK HERE Click on the above button to create a new array and display it let resEle = document.querySelector(".result"); document.querySelector(".Btn").addEventListener("click", () => { let arr = new Array(1, 2, 3, 4, "A", "B", "C", "D"); resEle.innerHTML = "arr = " + arr; }); OutputThe above code will produce the following output −On clicking the ‘CLICK HERE’ button−
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
383 Views
Splicing an array means to use the Array.splice() method for adding or removing items from the array. The items removed are returned as an array.Following is the code for splicing an array in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample, .result { font-size: 20px; font-weight: 500; } Splicing an array in JavaScript CLICK HERE Click on the above button to add items after second element ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
117 Views
Following is the code for deleting object properties in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result, .sample { font-size: 20px; font-weight: 500; } Delete object properties in JavaScript Before Deleting After deleting CLICK HERE Click on the above button to delete object properties let btnEle = document.querySelector(".btn"); let resEle = document.querySelector(".result"); let sampleEle = document.querySelector(".sample"); let obj = { firstName: ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
151 Views
Following is the code creating an object and accessing its properties in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; } Hoisting in JavaScript CLICK HERE Click on the above button to create and access a object let btnEle = document.querySelector(".btn"); let resEle = document.querySelector(".result"); let obj = { firstName: "Rohan", lastName: "Sharma", ... Read More