JavaScript/Object.prototype.toString.call:修订间差异
来自康健生活
创建页面,内容为“== 引言 == == 示例 == {{leftrightflex|<syntaxhighlight lang="javascript"> Object.prototype.toString.call([]) Object.prototype.toString.call({}) Object.prototype.…” |
|||
| 第2行: | 第2行: | ||
== 示例 == | == 示例 == | ||
{{leftrightflex|<syntaxhighlight lang="javascript"> | {{leftrightflex|<syntaxhighlight lang="javascript"> | ||
Object.prototype.toString.call([]) | Object.prototype.toString.call([]); | ||
Object.prototype.toString.call({}) | Object.prototype.toString.call({}); | ||
Object.prototype.toString.call('') | Object.prototype.toString.call(''); | ||
Object.prototype.toString.call(1)</syntaxhighlight>|{{consoleout|<pre> | Object.prototype.toString.call(1); | ||
Object.prototype.toString.call(null); | |||
Object.prototype.toString.call(undefined); | |||
Object.prototype.toString.call(true);</syntaxhighlight>|{{consoleout|<pre> | |||
"[object Array]" | "[object Array]" | ||
"[object Object]" | "[object Object]" | ||
"[object String]" | "[object String]" | ||
"[object Number]" | "[object Number]" | ||
"[object Null]" | |||
"[object Undefined]" | |||
"[object Boolean]" | |||
</pre>}}}} | </pre>}}}} | ||
== 判断 == | == 判断 == | ||
2020年6月23日 (二) 10:36的版本
No categories