I have an object where two parameters hold arrays as their values. When I try to output the types of these values using the typeof()
function in a loop, for some reason, I always get a string
type instead of the actual array
value.
const add = "add"
const edit = "edit"
const required = {
user: [add, edit],
profile: [edit],
}
for (let p in required) {
console.log(p, typeof(p))
}
Output:
string
string