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)
The simplest approach to check if something is a dictionary in Javascript in a way that will not also return true when given an array is:
true
if (a.constructor == Object) { // code here... }
This was inspired by the answer here.