我知道一种判断数组的方法是typeof arr instanceof Array.但是在网上看到说什么在不同框架下就不能这么判断?什么iframe的,怎么样才算不一样的框架?能举个例子吗?
v instanceof Array will return false if v was created in another frame (v is instance of thatFrame.contentWindow.Array class).
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
一个例子:
原文地址:
instanceof
considered harmful (or how to write a robustisArray
)这个好啊,以前还真不知道,这会儿赶紧恶补一下!!!
用instanceof typeof 本来就不是一个好方法