I have an object list in JavaScript, I want to get and parse "total" in a variable. But whenever I print or filter in console log, it always give null value.
var dd = result1[0] // orignal data
console.log(typeof dd) // this is object
console.log(dd); // this printing whole object list
// try 1
console.log(JSON.stringify(dd));
// try 2
for (const key in dd) {
if (dd.hasOwnProperty(key)) {
console.log(`${key}: ${dd[key]}`);
}
}
I tried JSON.stringify(dd)
, but nothing worked.