官术网_书友最值得收藏!

Exercise – adding a new function to the export object

Now it's time for a quick challenge. What I'd like you to do is make a new function in notes.js called add. This add function will get set on the exports object.

Remember, exports is an object, so you can set multiple properties.

This add function will take two arguments, a and b; it'll add them together and return the result. Then over in app.js, I'd like you to call that add function, passing in two numbers, whatever you like, such as 9 and -2, then print the result to the screen and make sure it works correctly.

You can get started by removing the call to addNote since this will not be needed for the challenge.

So, take a moment, create that add function inside notes.js, call it inside app.js, and make sure the proper result prints to the screen. How'd it go? Hopefully, you were able to make that function and call it from app.js.

主站蜘蛛池模板: 九寨沟县| 昭通市| 宝清县| 齐河县| 珠海市| 莱芜市| 万源市| 亳州市| 大宁县| 阿图什市| 榕江县| 衡水市| 邵阳县| 巫溪县| 呼和浩特市| 花莲县| 利辛县| 南江县| 时尚| 洪泽县| 商水县| 治县。| 新闻| 临桂县| 墨脱县| 博爱县| 嘉定区| 阜阳市| 普兰店市| 唐山市| 金阳县| 射阳县| 板桥市| 璧山县| 旬阳县| 深圳市| 白沙| 滨州市| 和硕县| 铜山县| 灵山县|