function getStringCount(obj) {
let countString = 0;
function foo(object) {
for (let i in object) {
if (typeof object[i] === "object") {
foo(object[i]);
} else {
if (typeof object[i] === "string") {
countString++;
}
}
}
}
foo(obj)
return countString;
}
function getStringCount(obj) {
let countString = 0;
for (let i in obj) {
if (typeof obj[i] === "object") {
countString += getStringCount(obj[i]);
} else if (typeof obj[i] === "string") {
countString += 1;
}
}
return countString;
}