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

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.

主站蜘蛛池模板: 开鲁县| 韶关市| 大田县| 临潭县| 新竹市| 德格县| 濮阳县| 易门县| 乐昌市| 安平县| 同仁县| 子长县| 寿光市| 罗城| 通江县| 娄烦县| 乐业县| 盈江县| 镇赉县| 惠来县| 比如县| 贡山| 孙吴县| 上虞市| 舞阳县| 平度市| 万州区| 兴安县| 新龙县| 德庆县| 勐海县| 白水县| 崇信县| 广元市| 株洲市| 兖州市| 鄢陵县| 德庆县| 浏阳市| 蚌埠市| 珲春市|