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

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.

主站蜘蛛池模板: 弥渡县| 南江县| 万宁市| 鱼台县| 黄平县| 巴林左旗| 乐东| 维西| 天水市| 合阳县| 台前县| 宁远县| 安阳县| 浦东新区| 南汇区| 宜君县| 威远县| 安达市| 关岭| 黔西县| 江山市| 阳城县| 紫金县| 化隆| 长沙县| 蒙山县| 盘锦市| 炎陵县| 松潘县| 开原市| 桐乡市| 凭祥市| 万宁市| 措勤县| 哈尔滨市| 威远县| 平南县| 南华县| 昌吉市| 朝阳市| 二连浩特市|