Last active
May 4, 2019 09:25
-
-
Save kovalenko-anton/346bdbfe2638b16a7ae6f9a870176a0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkNested(obj /*, level1, level2, ... levelN*/) { | |
var args = Array.prototype.slice.call(arguments, 1); | |
for (var i = 0; i < args.length; i++) { | |
if (!obj || !obj.hasOwnProperty(args[i])) { | |
return false; | |
} | |
obj = obj[args[i]]; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment