2.1 KiB
2.1 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
5cddbfd622f1a59093ec611d | Create a Module Script | 6 | 301198 |
Description
module
. Here’s an example:
<script type="module" src="filename.js"></script>
A script that uses this module
type can now use the import
and export
features you will learn about in the upcoming challenges.
Instructions
module
and give it the source file of index.js
Tests
tests:
- text: You should create a <code>script</code> tag.
testString: assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g));
- text: Your <code>script</code> tag should be of type <code>module</code>.
testString: assert(code.match(/<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g));
- text: Your <code>script</code> tag should have a <code>src</code> of <code>index.js</code>.
testString: assert(code.match(/<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g));
Challenge Seed
<html>
<body>
<!-- add your code below -->
<!-- add your code above -->
</body>
</html>
Solution
<html>
<body>
<!-- add your code below -->
<script type="module" src="index.js"></script>
<!-- add your code above -->
</body>
</html>