Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let someObject = {
- a: {
- b: {
- e: {}
- },
- c: {},
- d: {},
- },
- };
- const printAllKeys = (obj) => {
- if (typeof obj === 'object') {
- const keys = Object.keys(obj);
- keys.forEach((key) => {
- console.log(key);
- printAllKeys(obj[key]);
- });
- }
- };
- printAllKeys(someObject);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement