* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
1.5 KiB
1.5 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7db2367417b2b2512b8b | Understand the Immediately Invoked Function Expression (IIFE) | 1 | 理解立即调用的函数表达式(IIFE) |
Description
(function(){请注意,该函数没有名称,也没有存储在变量中。函数表达式末尾的两个括号()会立即执行或调用它。此模式称为
console.log(“Chirp,chirp!”);
})(); //这是一个立即执行的匿名函数表达式
//输出“Chirp,chirp!”立即
immediately invoked function expression
或IIFE
。 Instructions
makeNest
并删除它的调用,所以它是一个匿名的immediately invoked function expression
( IIFE
)。 Tests
tests:
- text: 该功能应该是匿名的。
testString: assert(/\((function|\(\))(=>|\(\)){/.test(code.replace(/\s/g, "")));
- text: 您的函数应在表达式的末尾加上括号以立即调用它。
testString: assert(/}\)\(\)/.test(code.replace(/\s/g, "")));
Challenge Seed
function makeNest() {
console.log("A cozy nest is ready");
}
makeNest();
Solution
// solution required