简体   繁体   English

为什么typeof +不是“函数” javascript

[英]Why typeof + is not “function” javascript

As in the title, why 如标题所示,为什么

typeof +

doesn't give "function"? 不提供“功能”?

+ is an operator , it's not a function. +运算符 ,不是函数。 typeof + is therefore a syntax error. 因此, typeof +是语法错误。

typeof only returns types of objects ( pretty much everything in JS ) and primitives. typeof只返回对象的类型( JS中几乎所有内容 )和基元。

See the MDN documentation for typeof . 有关typeof请参见MDN文档

As rid points out, + is an operator and not an object or primitive. 正如rid指出的, +是运算符,而不是对象或基元。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM