A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-functions-method/ below:

Lodash _.functions() Method - GeeksforGeeks

Lodash _.functions() Method

Last Updated : 03 Nov, 2023

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

Syntax:
_.functions(object);
Parameters: Return Value:

This method returns an array of properties.

Example 1: In this example, we are getting the array of the properties by the use of the lodash _.functions() method.

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: In this example, we are getting the array of the properties by the use of the lodash _.functions() method.

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.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4