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
Javascript Articles - Page 389 of 607
2K+ Views
The dot notation and bracket notation both are used to access the object properties in JavaScript. The dot notation is used mostly as it is easier to read and comprehend and also less verbose. The main difference between dot notation and bracket notation is that the bracket notation allows us to access object properties using variable.Following is the code for bracket notation vs dot notation in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; ... Read More
2K+ Views
The dot notation is used to access the object properties in JavaScript. Following is the code to implement dot notation −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; color: blueviolet; } Dot notation in JavaScript. CLICK HERE Click on the above button to access the student1 object properties using dot notation let resEle = document.querySelector(".result"); let BtnEle = document.querySelector(".Btn"); function ... Read More
450 Views
Following is the code to check if an object is an instance of a class in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; color: blueviolet; } Check if an object is an instance of a Class CLICK HERE Click on the above button to check if student1 object is an instance of Student let resEle = document.querySelector(".result"); function Student(name, ... Read More
175 Views
Static properties are assigned to the class function itself and not to its prototype property. These properties can be called directly without instantiating any objects.Following is the code for static properties in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; color: blueviolet; } Static Properties in JavaScript CLICK HERE Click on the above button to the access the static property school of Student ... Read More
686 Views
Methods can be shared by attaching them to the prototype property of the object. These methods will be shared among all the instances of the object.Following is the code for sharing methods in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; color: blueviolet; } Shared methods in JavaScript CLICK HERE Click on the above button to the call the displayInfo method of student1 ... Read More
430 Views
Properties can be shared by attaching them to the prototype property of the object. These properties will be shared among all the instances of the object.Following is the code for sharing properties in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 20px; font-weight: 500; color: blueviolet; } Shared properties in JavaScript CLICK HERE Click on the above button to the view properties of student1 and student2 ... Read More
373 Views
Following is the code to implement queue in JavaScript.Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: blueviolet; } button { padding: 6px; margin: 4px; } Implementation of queue in JavaScript. Enqueue Dequeue Display Click on the above buttons to perform queue operations let resEle = document.querySelector(".result"); let BtnEle = ... Read More
500 Views
Following is the code to implement stack in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: blueviolet; } button { padding: 6px; margin: 4px; } Implementation of Stack in JavaScript. Push Pop Display Click on the above buttons to perform stack operations let resEle = document.querySelector(".result"); let BtnEle = document.querySelector(".Btn"); ... Read More
579 Views
Following is the code to loop through array of arrays containing objects in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .result { font-size: 18px; font-weight: 500; color: rebeccapurple; } Loop through array of arrays containing objects in JavaScript CLICK HERE Click the above button to loop throught the arrObj let BtnEle = document.querySelector(".Btn"); let resEle = document.querySelector(".result"); let arrObj = [ ... Read More
3K+ Views
Following is the code to pass event objects from one function to another in JavaScript −Example Live Demo Document body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } Pass event objects from one function to another in JavaScript CLICK HERE Click the above button to change its font size and color function changeFont(event) { event.target.style.fontSize = "32px"; changeColor(event); } function changeColor(event) { event.target.style.color = "red"; } OutputThe above code will produce the following output −On clicking the ‘CLICK HERE’ button −