fixed arrow function with no curly braces failing IIFE test (#38544)
* fixed arrow function with no curly braces failing IIFE test * added iife 2nd test fix and 3 new solutions
This commit is contained in:
parent
d739a0cc5d
commit
2b60f3e61e
@ -30,9 +30,9 @@ Rewrite the function <code>makeNest</code> and remove its call so instead it's a
|
||||
```yml
|
||||
tests:
|
||||
- text: The function should be anonymous.
|
||||
testString: assert(/\((function|\(\))(=>|\(\)){/.test(code.replace(/\s/g, "")));
|
||||
testString: assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, "")));
|
||||
- text: Your function should have parentheses at the end of the expression to call it immediately.
|
||||
testString: assert(/}\)\(\)/.test(code.replace(/\s/g, "")));
|
||||
testString: assert(/}?\)\(\)$|}\(\)\)$/.test(code.replace(/[\s;]/g, "")));
|
||||
|
||||
```
|
||||
|
||||
@ -67,4 +67,22 @@ makeNest();
|
||||
})();
|
||||
```
|
||||
|
||||
```js
|
||||
(function () {
|
||||
console.log("A cozy nest is ready");
|
||||
}());
|
||||
```
|
||||
|
||||
```js
|
||||
(() => {
|
||||
console.log("A cozy nest is ready");
|
||||
})();
|
||||
```
|
||||
|
||||
```js
|
||||
(() =>
|
||||
console.log("A cozy nest is ready")
|
||||
)();
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user