There is a function that returns key of an object based on some condition, if the key it is returning is 0, then the value I get is undefined
var obj = {'some','values'};
function getObjectKey(){
obj.forEach(function(value, key) {
if(some condition){
return key;
}
});
}
var objectKey = getObjectKey();
console.log(objectKey); //returns `undefined` if the key returned is 0.
How can I get the key if the key is 0?