- 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 6704 Articles for Javascript
186 Views
Use the super() function to call the constructor of the parent class and access functions on an object's parent class.ExampleYou can try to run the following code to implement super()Live Demo class Department { constructor() {} static msg() { return 'Hello'; } } class Employee extends Department { constructor() {} static displayMsg() { return super.msg() + ' World!'; } } document.write(Employee.displayMsg());
162 Views
for…in loopThe “for...in” loop is used to loop through an object's properties.Here’s the syntax −Syntaxfor (variablename in object) { statement or block to execute }You can try to run the following example to implement ‘for-in’ loop. It prints the web browser’s Navigator objectExampleLive Demo var aProperty; document.write("Navigator Object Properties "); for (aProperty in navigator) { document.write(aProperty); document.write(""); } document.write ("Exiting from the loop!"); for…of loopThe “for…of” loop is used to loop through iterable objects, which includes Map, Array, arguments, etc.SyntaxHere’s the syntax −for (variablename of iterable){ statement or block to execute }ExampleHere’s an example showing ... Read More
14K+ Views
The onsubmit event occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here we are calling a validate() function before submitting a form data to the webserver. If validate() function returns true, the form will be submitted, otherwise it will not submit the data. The HTML code snippet. …
311 Views
The +function() {} notation is primarily used to force the parser to treat whatever follows the + as an expression. This is used for functions that are invoked immediately, for example,+function() { alert("Demo!"); }();However, + before a function is one of the symbol. You can add other options also like !, -, ~, also. Parentheses can also be used as shown below:(function() { alert("Demo!"); })();You can also use it like this:(function() { alert("Demo!"); }());
240 Views
The onmouseout triggers when you move your mouse out from that element.ExampleYou can try to run the following example to learn how to call a JavaScript function from onmouseout eventLive Demo Bring your mouse inside the division to see the result: This is inside the division
1K+ Views
The onmouseover event triggers when you bring your mouse over any element.ExampleYou can try to run the following example to learn how to call a JavaScript function from onmouseover eventLive Demo Bring your mouse inside the division to see the result: This is inside the division
2K+ Views
The onsubmit event occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here, we are calling a validate() function before submitting a form data to the webserver. If validate() function returns true, the form will be submitted, otherwise it will not submit the data. The HTML .......
384 Views
The prompt dialog box is very useful when you want to pop-up a text box to get user input. Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK.This dialog box is displayed using a method called prompt() which takes two parameters: (i) a label which you want to display in the text box and (ii) a default string to display in the text box.This dialog box has two buttons: OK and Cancel. If the user clicks the OK button, the window method prompt() will return the entered value ... Read More
4K+ Views
In this tutorial, we will learn to get a timestamp in JavaScript. It never happens that software developers or application developers don’t require to play with date and time. In many situations, they are required to play with date and timestamp. For example, to show the time on the user’s dashboard, save the time of an operation in the database.Now, let’s understand what the timestamp is? The timestamp is the total number of milliseconds from the 1st January 1970 from when UNIX epochs begin. Using the timestamp, we can extract the date, day, year, month, hours, minutes, second, milliseconds, etc.So, ... Read More