typeof foo will just evaluate to 'object' whether foo is a list [] or a dictionary {} or any kind of object. How can one tell the difference?
In Javascript, arrays are objects, as is the value null. You simply use the Array.isArray method to see if anything is one.
const obj = {}
const arr = []
Array.isArray(obj) // false
Array.isArray(arr) // true