node.js中的path.basename方法使用说明
方法说明:
提取出用 ‘/' 隔开的path的最后一部分。(8详见例子)
语法:
path.basename(p, [ext])
由于该方法属于path模块,使用前需要引入path模块(var path= require(“path”) )
接收参数:
p 要处理的path
ext 要过滤的字符
例子:
var path= require("path"); path.basename('/foo/bar/baz/asdf/quux.html') // returns 'quux.html' path.basename('/foo/bar/baz/asdf/quux.html', '.html') // returns 'quux' var a = path.basename('/foo/bar/baz/asdf/', '.html'); // returns 'asdf'
node.js中的console.timeEnd方法使用说明
方法说明:完成时间,执行console.time到console.timeEnd之间所花费的时间。语法:console.timeEnd(label)接收参数:Label与开始时间console.log的label对应例子:console
node.js中的console.time方法使用说明
方法说明:开始时间,与console.timeEnd对应,记录时间段。语法:console.time(label)接收参数:Label与开始时间console.log的label对应例子:console.time('100-elements')
node.js中的console.trace方法使用说明
方法说明:向标准错误流输出当前的调用栈。语法:console.trace(label)接收参数:label例子:console.trace();//运行结果:Trace:atObject.anonymous(/home/byvoid/consoletrac
标签:方法,例子,时间,语法,参数