位置: 编程技术 - 正文

chrome调试javascript详解(Chrome调试技巧)

编辑:rootadmin

推荐整理分享chrome调试javascript详解(Chrome调试技巧),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:Chrome调试app,chrome调试窗口怎么打开,Chrome调试vue,Chrome调试怎么直接修改代码,Chrome调试vue,Chrome调试技巧,Chrome调试模式,Chrome调试vue,内容如对您有帮助,希望把文章链接给更多的朋友!

一、Console API

Console.assert()

判断第一个参数是否为真,false的话抛出异常并且在console输出相应信息。

Console.count()

以参数为标识记录调用的次数,调用时在console打印标识以及调用次数。

Console.debug()

console.log方法的别称,使用方法可以参考Console.log()

Console.dir()

打印一条以三角形符号开头的语句,可以点击三角展开查看对象的属性。

Console.error()

打印一条错误信息,使用方法可以参考 string substitution。

Console._exception()

error方法的别称,使用方法参考Console.error()

Console.group()

打印树状结构,配合groupCollapsed以及groupEnd方法;

Console.groupCollapsed()

使用方法和group相同,不同的是groupCollapsed打印出来的内容默认是折叠的。

Console.groupEnd()

结束当前Tree

Console.info()

打印以感叹号字符开始的信息,使用方法和log相同

Console.log()

打印字符串,使用方法比较类似C的printf格式输出

Console.profile()

可以以第一个参数为标识,开始javascript执行过程的数据收集。和chrome控制台选项开Profiles比较类似,具体可参考chrome profiles

Console.profileEnd()

配合profile方法,作为数据收集的结束。

Console.table()

将数据打印成表格。Console.table [en-US]

Console.time()

计时器,接受一个参数作为标识。

Console.timeEnd()

接受一个参数作为标识,结束特定的计时器。

chrome调试javascript详解(Chrome调试技巧)

Console.trace()

打印stack trace.

Console.warn()

打印一个警告信息,使用方法可以参考 string substitution。

二、用法

1、Console.log

旧版兼容

输出对象

格式化

%s 格式string%d or %i 格式int%f 格式float%o 格式Object对象%O 格式object对象%c 格式css

输出对象

Google chrome .0.. m 上图片出不来

Firefox .0.2 下测试

不过网上有一个有趣的东西 console.image,chrome自带的有扩展 car = "Dodge Charger";var someObject = {str:"Some text", id:5};console.info("My first car was a", car, ". The object is: ", someObject); for (var i=0; i<5; i++) { console.log("Hello, %s. You've called me %d times.", "Bob", i+1);}console.log("I want to print a number:%d","string")

3、console.group/console.warn/console.time/console.debug

console.log("This is the outer level");console.group();console.log("Level 2");console.group();console.log("Level 3");console.warn("More of level 3");console.groupEnd();console.log("Back to level 2");console.groupEnd();console.debug("Back to the outer level");console.time("answer time");alert("Click to continue");console.timeEnd("answer time");

4、console.trace 在页面console文档中查看堆栈跟踪的详细介绍和示例.这个比较好用

5、console.assert/console.count/console.dirxml/console.dir/console.error

6、Other Command Line API

7、debugger 非常好用的一个工具

调试的时候还可以加断点什么的……

8、jquery相关 firequery

这样就可以 easily check inside jQuery chains.

四、相关资源

can also now use Firefox's built in developer tools Ctrl+Shift+J (Tools > Web Developer > Error Console), but Firebug is much better; use Firebug)Safari and ChromeBasically the same. ExplorerDon't forget you can use compatibility modes to debug IE7 and IE8 in IE9 or you must access the console in IE6 for IE7 use the Firebug Lite look for stable for all iPhones, iPod touch and iPads. with iOS 6 you can view the console through Safari in OS X if you plug in your device. Or you can do so with the emulator, simply open a Safari browser window and go to the "Develop" tab. There you will find options to get the Safari inspector to communicate with your device.Windows Phone, AndroidBoth of these have no console built in and no bookmarklet ability. So we use :listen and it will give you a script tag to place in your HTML. From then on you can view your console inside the jsconsole website.iOS and AndroidYou can also use to access web inspector tools and the console on any device using their convenient browser plugin.Older browser problemsLastly older browsers (thanks again Microsoft) will crash if you use console.log in your code and not have the developer tools open at the same time. Luckily its an easy fix. Simple use the below code snippet at the top of your code and good old IE should leave you alone: if(!window.console){ window.console = {log: function(){} }; }This checks to see if the console is present, and if not it sets it to an object with a blank function calledlog. This way window.console and window.console.log is never truly undefined.

JS+CSS实现的经典圆角下拉菜单效果代码 本文实例讲述了JS+CSS实现的圆角下拉菜单效果代码。分享给大家供大家参考,具体如下:相信不少朋友会喜欢这一款菜单,CSS+JS实现的圆角下拉菜单,

在javascript中随机数 math random如何生成指定范围数值的随机数 今天有朋友向我请教:JavaScript怎么生成指定范围数值随机数。Math.random()这个方法相信大家都知道,是用来生成随机数的。不过一般的参考手册时却没有

JS实现Fisheye效果动感放大菜单代码 本文实例讲述了JS实现Fisheye效果动感放大菜单代码。分享给大家供大家参考,具体如下:这款FisheyeMenu,是采用JS+CSS+XHTML实现的动感放大菜单,放到图标

标签: Chrome调试技巧

本文链接地址:https://www.jiuchutong.com/biancheng/381623.html 转载请保留说明!

上一篇:Javascript 计算字符串在localStorage中所占字节数(js计算字体宽度)

下一篇:JS+CSS实现的经典圆角下拉菜单效果代码(html css js 实战案例)

  • 我国增值税征收范围
  • 企业消费税会计处理案例
  • 税收契子怎么算
  • 小规模纳税人零申报是每季度报吗
  • 企业所得税季度申报时间
  • 个人所得税数据已失效,请重新填写
  • 财务人员培训费怎么入账
  • 小规模国税怎么报税
  • 特殊销售业务包括什么
  • 定额材料损耗率国家标准
  • 公司借股东钱支付的利息如何做账?
  • 教育协会发的证有用吗
  • 补开的银行手续费发票怎么做账
  • 营业利润为负数说明什么
  • 视同销售存货账务处理方法是什么?
  • 生产过程中产生的废料怎么管理
  • 购进机器进项税额怎么核算?
  • 网络招聘合同
  • 社保可以在税前扣除吗
  • 税控盘清盘怎么做
  • 开专票必须公对公付款不然不开
  • 个人之间的房屋抵押需要去房管局做登记吗
  • 怎样预交增值税
  • 普票丢失的最新处理2019
  • 金融资产包括哪三大类及会计科目
  • 产品检测费用计入什么科目
  • 费用结转到本年利润是手动还自动结转?
  • 环保税是甲方交的吗
  • 小规模纳税人未达到起征点的增值税怎么做账
  • 上个月开票这个月确认收入
  • 货币资金包括哪些
  • microsoft edge怎么设置关闭所有网页
  • 事业单位收到奖励款怎么入账
  • windows10自带桌面时钟
  • 付款凭证怎么填写电脑
  • 加油费属于什么费用类别的
  • 非贸付汇代扣代交哪些税
  • 【创作赢红包】ChatGPT引爆全网引发的AI算力思考
  • 让我用用你的计算机
  • 支付网络服务费属于现金流量表的哪一项
  • 代缴社保可以领住房补贴吗
  • audo命令
  • python的series
  • 国家退税收到的钱在哪里
  • 白酒贴牌酒是真酒还是假酒
  • Python中__slots__限制属性
  • 深入理解jvm第三版pdf百度云
  • 房屋租赁时需要交税吗
  • mssql分布式数据库
  • 报销流程怎么走
  • 公司买灭草剂怎么入账
  • 应付职工薪酬的工资是实发工资还是应发工资
  • 企业汇算清缴需要提供什么资料
  • 企业被收购的账务处理
  • 2020公司年会奖品清单
  • 学校固定资产账记法
  • 在linux系统中
  • win8defender怎么打开
  • w10预览版21343下载
  • 惠普装xp系统
  • centos设置永不待机
  • Windows 8中Hyper-V虚拟机操作应用的具体步骤
  • win降win7
  • win7关掉wifi
  • linux bye
  • cocos2dx官方教程
  • opengl控制物体移动
  • 奇门遁甲实例详解
  • 英语中our和my的区别
  • android开发最全教程
  • python制作gui
  • mongoose操作
  • linux中的shell命令
  • javascript数学函数
  • android基础教程第三版电子版
  • python的get
  • 国家税务局浙江省电子税务局新版
  • 财务跨期报销问题
  • 税务稽查立案标准的法律文件
  • 办公厅机构设置方案
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设