I have a simple program like:
var a = {\'a\': 1, \'b\': 2}
console.log(a)
console.log(a instanceof Array)
console.log(a.constructor instanceof Array)
You can use this to check either your dict(data) is a dictionary or not !
var dict = { a: 1, b: { c: 3, d: 4 }, e: 9 };
// this function will true / false
const isDict = dict => {
return typeof dict === "object" && !Array.isArray(dict);
};
console.log(isDict(dict)); // true
this will return you true if it is a dictionary otherwise return false