Skip to content

Instantly share code, notes, and snippets.

View Sooro1024's full-sized avatar
😃
Exploring the front-end world

Suren Gorgoyan Sooro1024

😃
Exploring the front-end world
View GitHub Profile
@harish2704
harish2704 / lodash.get.js
Last active June 3, 2023 23:41
Simple lodash.get function in javascript
/* Implementation of lodash.get function */
function getProp( object, keys, defaultVal ){
keys = Array.isArray( keys )? keys : keys.split('.');
object = object[keys[0]];
if( object && keys.length>1 ){
return getProp( object, keys.slice(1) );
}
return object === undefined? defaultVal : object;
}