console.log(typeof typeof a);
打印为 string
解释:typeof a 输出的是undefined,虽然undefined表达的是未定义的元素,但对于‘undefind’这个元素本身来说,‘undefined’是字符串,所以整个语句可以看出console.log(typeof 'undefined');输出的就是string。
console.log(typeof typeof a);为什么打印的是string类型
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
门前大桥下. 2021-08-26 08:28关注//typeof 是个函数 他的返回值 就是string类型 所以 a var a=typeof b b未定义-------- undefined a 此时的值: string ------"undefined" typeof a 就等同于 typeof "undefined" 返回字符串类型 的" string" "string" console.log(typeof typeof a); 从右边往左边计算 typeof a的返回值 给 左边的typeof 当做参数 去运行了评论 打赏 举报解决 1无用