//将输入值加倍并返回您也可以将多个参数传递给箭头函数。
const doubler =(item)=> item * 2;
myConcat
函数,该函数将arr2
内容追加到arr1
以便该函数使用箭头函数语法。 var
关键字。
testString: 'getUserInput => assert(!getUserInput("index").match(/var/g), "User did replace var
keyword.");'
- text: myConcat
应该是一个常量变量(使用const
)。
testString: 'getUserInput => assert(getUserInput("index").match(/const\s+myConcat/g), "myConcat
should be a constant variable (by using const
).");'
- text: myConcat
应该是一个函数
testString: 'assert(typeof myConcat === "function", "myConcat
should be a function");'
- text: myConcat()
返回正确的array
testString: 'assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, "myConcat()
returns the correct array
");'
- text: function
关键字未使用。
testString: 'getUserInput => assert(!getUserInput("index").match(/function/g), "function
keyword was not used.");'
```