Extract an exact key from object in Underscore.js -
i using underscore.js library. want extract exact key object.
var student = {sid : 101; sname: "abc"}
i have tried this.
var key = _.findkey(student, 'sid');
but showing 'undefined' in key variable. me.
the _.findkey
can used this:
_.findkey(student, function(x){ return x === 101}); // returns 'sid'
Comments
Post a Comment