max*_*mus 5 javascript jquery object
任何人都可以解释jQuery.isPlainObject()和jQuery.isEmptyObject()之间的区别是什么?对于没有属性的对象,它们都返回true.例子
jQuery.isEmptyObject({}); // returns true
jQuery.isPlainObject({}); // returns true
Run Code Online (Sandbox Code Playgroud)
提前致谢.
jQuery.isEmptyObject()
Run Code Online (Sandbox Code Playgroud)
如果对象为空,则此函数将返回true(顾名思义).
jQuery.isPlainObject()
Run Code Online (Sandbox Code Playgroud)
如果它是对象文字或(不太常见)使用" new Object()
" 创建对象,则此函数将返回true .
此示例可能有所帮助:
jQuery.isEmptyObject({ 'try' : 'this' }); // returns false
jQuery.isPlainObject({ 'try' : 'this' }); // returns true
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6640 次 |
最近记录: |