发现了一个非常好的JavaScript调试方法,目前看到的是可以打印Object/Array/Function/String四种类型,使用方法和PHP中的var_dump()一样,只要直接dump(变量名)即可。
复制代码 代码如下:
dump(value, [showTypes])
@ param value (Any) value to dump
@ param [showTypes] (Boolean) optional to display each key/value's type
@ return (Void) returns nothing
The Dump method is based on one of the tags available in Coldfusion ( <cfdump>) providing the ability to display simple and complex variables in a user friendly way that is perfect for debugging/inspecting data. There is no way to do this with javascript and often I had wanted a method to do this. This method will do just that allowing for an infinite amount of data nesting complete with color coding for different data types, the ability to show/hide the data's type (String/Number/Boolean/Object/Array/Function), expandable and collapsible tables/keys and cross browser support.
Click on the buttons bellow to see some examples in action, toggle the Show Data Types box to see javascript data typing in action (not possible in Coldfusion).
Browser Support
Internet Explorer 6, Internet Explorer 7, Firefox 1.5, Opera 8, Safari 1.2 (Mac), Firefox (Mac) - all tested, should also work in most other browsers
Dump Examples
官方网址
http://www.netgrow.com.au/files/javascript_dump.cfm
相关文件
http://www.netgrow.com.au/assets/files/dump/dump.zip
以防上面的地址下载不了,本地下载地址
https://www.jb51.net/jiaoben/20804.html
复制代码 代码如下:
dump(value, [showTypes])
@ param value (Any) value to dump
@ param [showTypes] (Boolean) optional to display each key/value's type
@ return (Void) returns nothing
The Dump method is based on one of the tags available in Coldfusion ( <cfdump>) providing the ability to display simple and complex variables in a user friendly way that is perfect for debugging/inspecting data. There is no way to do this with javascript and often I had wanted a method to do this. This method will do just that allowing for an infinite amount of data nesting complete with color coding for different data types, the ability to show/hide the data's type (String/Number/Boolean/Object/Array/Function), expandable and collapsible tables/keys and cross browser support.
Click on the buttons bellow to see some examples in action, toggle the Show Data Types box to see javascript data typing in action (not possible in Coldfusion).
Browser Support
Internet Explorer 6, Internet Explorer 7, Firefox 1.5, Opera 8, Safari 1.2 (Mac), Firefox (Mac) - all tested, should also work in most other browsers
Dump Examples
官方网址
http://www.netgrow.com.au/files/javascript_dump.cfm
相关文件
http://www.netgrow.com.au/assets/files/dump/dump.zip
以防上面的地址下载不了,本地下载地址
https://www.jb51.net/jiaoben/20804.html
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“Javascript中的var_dump函数实现代码”评论...
更新动态
2024年11月13日
2024年11月13日
- 群星《唱给女人的歌》24K德国HD金碟[WAV+CUE]
- 孙燕姿.2011-是时候【美妙音乐】【WAV+CUE】
- 苏芮.2003-回首·时代全经典2CD【华纳】【WAV+CUE】
- 梁咏琪.1996-爱自己【EEI】【WAV+CUE】
- IGN经典逆天骚操作名著——《墙头草修炼手册》
- 突然爆火的“网红游戏”,真的有那么多人玩吗?
- 何老师客串《浪人崛起》了?盘点与明星撞脸的角色!
- 【原神】关于星鹫赤羽对珐芙琴班配队下珐露珊主C的适配度分析
- 【原神】V5.1攻略 | 迪西雅角色简评
- 【原神】大日御舆顶端怎么上去
- 胥拉齐《感谢有你》DTS-WAV
- 罗海英《金牌歌后》【WAV+CUE】
- 林叶《林叶·夜》【WAV/分轨】
- 群星《国语经典名曲01》音乐磁场系列[WAV+CUE][1G]
- 齐豫《滚石24K》24K金碟珍藏版系列[低速原抓WAV+分轨][1G]