node.js中的console.assert方法使用说明
方法说明:
该方法和assert.ok()相同。如果表达式(expression)求值结果是false将会抛出一个AssertionError伴随着提示信息(message)
语法:
console.assert(expression,[message])
接收参数:
expression 表达式
message 错误提示信息
例子:
vara=0; console.assert(a==1,'error!');
源码:
Console.prototype.assert=function(expression){
if(!expression){
vararr=Array.prototype.slice.call(arguments,1);
require('assert').ok(false,util.format.apply(this,arr));
}
};
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短