Tuesday, November 19, 2024
Google search engine
HomeLanguagesJavascriptLodash _.functions() Method

Lodash _.functions() Method

The Lodash _.functions() Method creates an array of function property names from own enumerable properties of the given object.

Syntax:

_.functions( object )

Parameters: This method accepts single parameters as mentioned above and described below:

  • object: This is the object to inspect.

Return Value: This method returns an array of properties.

Example 1:

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
  
// Defining object function
function GFGfunc() {
  this.Geek1 = _.constant('gfg');
  this.Geek2 = _.constant('gfg');
}
   
// Use of function
console.log(_.functions(new GFGfunc));


Output:

[ 'Geek1', 'Geek2' ]

Example 2:

Javascript




// Defining Lodash variable 
const _ = require('lodash'); 
  
  
// Defining object function
function GFGfunc() {
  this.Geek1 = _.constant('gfg');
  this.Geek2 = _.constant('gfg');
}
  
GFGfunc.prototype.Geek3 = _.constant('gfg');
   
// Use of function
console.log(_.functions(new GFGfunc));


Output:

[ 'Geek1', 'Geek2' ]

Note: This will not work in normal JavaScript because it requires the lodash library to be installed and can be installed using npm install lodash.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments