新建源代码及测试代码目录,目录结构如下:
project
- node_modules
- *(node 模块)
- src
- FQA
- index.js
- test
- unit
- specs
- *.spec.js
- karma.conf.js
- package.json
测试代码
index.js 源码
/**
- test map method callback and parseInt param use
- @return {[Array]} [Array]
*/
function checkMap() {
var nums = ['1', '2', '3'];
return nums.map(parseInt);
}
/**
- test null is Object,and common object is same
- @return {[Array]} [Array]
*/
function typeofAndInstanceOf
原文转自:https://segmentfault.com/a/1190000006969924