新建源代碼及測試代碼目錄,目錄結構如下:
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