const data = {
a: "asdsa",
c: "dsad",
f: {
sadasd: "dasd",
w: "sad",
m: {
asd: "sad",
asdw: {
w: "das",
q: ["das"],
},
},
},
d: "dsad",
};
const objectToKey = (dataGiven) => {
const keyData = [];
function cb(dataInp) {
for (const key in dataInp) {
const element = dataInp[key];
keyData.push(key);
if (element.constructor.name === "Object") {
cb(element);
}
}
}
cb(dataGiven);
return keyData;
};
console.log(objectToKey(data));
Last active
August 9, 2022 15:57
-
-
Save Rafat97/94d495fb7453597ee628d62ebad44c21 to your computer and use it in GitHub Desktop.
Random Problems
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment