我有一个对象,其中两个参数将数组保存为它们的值.当我try 在循环中使用typeof
运算符输出这些值的类型时,出于某种原因,我总是得到string
类型而不是实际的array
值.
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