Syntax Of Lodash once method
_.once(func)
Creates a function that is restricted to invoking the func Lodash once method. Repeat calls to the function return the value of the first invocation. The func is invoked with this binding and arguments of the created function.
Arguments
- func (Function) − The function to restrict.
Output
- (Function) − Returns the new restricted function.
Example
var _ = require('lodash'); var create = function(){ console.log('Object Created.')}; var init = _.once(create); init(); init(); init(); init();
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
Object Created.
Next Topic – Click Here
Pingback: Lodash - negate method - Adglob Infosystem Pvt Ltd
I’m typically to running a blog and i actually admire your content. The article has actually peaks my interest. I’m going to bookmark your web site and hold checking for brand new information.