- 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 8895 Articles for Front End Technology
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
443 Views
In this tutorial, let us discuss the smart, self-overwriting, or lazy-getters in JavaScript. A getter binds the property of an object to a function, but the getter will not calculate the property value until we access it. The getter helps when we need to get some dynamic value without an explicit call. Users can follow the syntax below to work with the getters. Syntax { get prop() {} } { get [exp]() {} } The prop and the exp are the object's properties that bind to a function. 'prop' is a simple object property, and 'exp' is an expression. ... Read More
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
10K+ Views
This tutorial teaches us to execute JavaScript at the command prompt.JavaScript is the most popular language among programming languages that work with the browser. It is helpful to add the behaviors to the webpage and make it attractive. So, everyone can run JavaScript efficiently in the browser, but what if they want to run JavaScript via command prompt or other terminals.Here, we have different approaches to running JavaScript at the command prompt.Using the Node.jsOne of the most popular ways to run server-side JavaScript via command prompt is the use of Node.js. Node.js is the run time environment for JavaScript. The ... Read More
![Ramu Prasad](https://www.tutorialspoint.com/assets/profiles/13539/profile/60_87996-1512650215.jpg)
189 Views
To concatenate several string, use “Array.join()” method. Here, we will concat the following strings:John Amit SachinExampleYou can try to run the following code to concat several stringsLive Demo var arr = ['Amit', 'John', 'Sachin']; document.write(arr.join(', '));
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
193 Views
Function overloading occurs when a function performs different tasks based on a number of arguments passed to it.The best practice for function overloading with parameters is to not check the types. The code runs slower when the type is checked and it should be avoided. For this, the last parameter to the methods should be an objectAlso, do not check the argument length.ExampleHere’s an example −function display(a, b, value) { } display(30, 15, {"method":"subtract"}); display(70, 90, {"test":"equals", "val":"cost"});
![Fendadis John](https://www.tutorialspoint.com/assets/profiles/13534/profile/60_64028-1512539837.jpg)
13K+ Views
To view events fired on an element, follow the below steps in Google Chrome:Open Google Chrome and press F12 to open Dev Tools.Now go to Sources TabGo to Event Listener Breakpoints, on the right:Click on the events and interact with the target element.If the event will fire, then you will get a breakpoint in the debugger.
![usharani](https://www.tutorialspoint.com/assets/profiles/13564/profile/60_32161-1512638316.jpg)
141 Views
The yield keyword is used in JavaScript to pause and resume a generator function. The value of the expression is returned to the generator's caller.Here’s the syntax, where “exp” is the expression and the optional value is returned by “val”, which is passed to the generator's next() method.[val] = yield [exp];Here are the examples:function* displayRank () { var selPlayers= [1, 2, 3, 4]; for (var a = 0; a < selPlayers.length; a++) { yield selPlayers[i]; } }After defining a generator function, use it like the following.Here displayRank() is the generator function:var rank = displayRank(); ... Read More
![varun](https://www.tutorialspoint.com/assets/profiles/13559/profile/60_29674-1512637943.jpg)
274 Views
The immediate function executes as soon as it is defined. To understand the role of immediate function, let’s see the difference between a function and an immediate function −Here’s immediate function −(function() { var str = "display"; }()); function display() { // this returns undefined alert(str); }Here’s a function −var str = "display"; function display() { // This returns "display" alert(str); }Let’s see another example of immediate functions −var name = 'Amit'; (function(sName) { alert( 'Student name = ' + sName ); }(sName))
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
985 Views
In this tutorial, we will look at the method to preserve variables in a JavaScript closure function. What is a closure function? A closure function gives access to the scope of an outer function from an inner function. It also allows private variables. Closure variables are stored in stack and heap. When a function is created, closure is also created. Closure remembers external things used in it. Closures are the primary mechanism for data privacy. One drawback is that the variables used are not garbage collected. Overuse of closure functions will damage the system due to redundant ... Read More
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
4K+ Views
In JavaScript, the functions wrapped with parenthesis are called “Immediately Invoked Function Expressions" or "Self Executing Functions.The purpose of wrapping is to namespace and control the visibility of member functions. It wraps code inside a function scope and decrease clashing with other libraries. This is what we call Immediately Invoked Function Expression (IIFE) or Self Executing Anonymous Function.Here’s the syntax −(function() { // code })();As you can see above, the following pair of parentheses converts the code inside the parentheses into an expression −function(){...}In addition, the next pair, i.e. the second pair of parentheses continues the operation. It calls ... Read More