2019-06-28 16:04:59 +08:00

1.6 KiB
Raw Blame History

id, title, challengeType
id title challengeType
5cddbfd622f1a59093ec611d Create a Module Script 1

Description

Javascript started with a small role to play on an otherwise mostly html internet. Today, its huge, and some websites are built almost entirely with javascript. In order to make javascript more modular, clean, and maintainable, ES6 introduced a way easily share code amongst javascript files. This involves exporting parts of a javascript file for use in one or more other files, and importing the parts you need to each file. In order to take advantage of this functionality, you need to create a script in your html file with a type of module. Heres 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

Add a script to the html document of type module and give it the source file of index.js

Tests

tests:
  - text: <code>var</code> should not exist in code.
    testString: getUserInput => assert(!getUserInput('index').match(/var/g),'<code>var</code> should not exist in code.');

Challenge Seed

<html>
  // add your code below

  // add your code above
</html>

Solution

<html>
  // add your code below

  // add your code above
</html>