js打印异常日志

1、代码

var x = 12;
console.assert(x==12,  "this will pass")
console.assert(x>12,  "this will fail")

第一个参数放我们希望成立的表达式,如果运行时不成立则打印这个异常,系统会将调用堆栈也打印出来。【QML中使用】

详情可查阅Qt手册:console log

posted @ 2022-01-06 18:34  朱小勇  阅读(537)  评论(0编辑  收藏  举报