Javascript: Facade

JavaScript fundamentals
Last update: 14 Sep 16:03
0
Students

The developer who worked on the project before you scattered all the functions related to mathematical calculations in different files named numbers1.js, numbers2.js and numbers3.js.

Moreover, he also made strange function names: all names in the file numbers2.js end with a 2, for example, sum2().

You quickly recognized that this is cumbersome and that you must design a unified interface to access them (they say "facade").

To do so, create a new module in the file math.js that contains all of the functions from all of the listed modules.

math.js

The task is to make file math.js to import all the functions from the three files described above and put them outside (that is, re-export them) under the following names: pow, sum, sub, sqrt and multi; and also export the function cube() as default.

We don't define where each function is located or what names they have on purpose. We don't say how they're all exported, either.

The goal of this task is for you to gain a thorough understanding of the module system, which will make your life much easier in the future.

Don't forget to analyze the test file to understand how the math.js module is used.

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests