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

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.

主站蜘蛛池模板: 望都县| 建昌县| 屯昌县| 东兰县| 仙居县| 麦盖提县| 和平县| 通州区| 兴安盟| 博罗县| 两当县| 合作市| 东乡族自治县| 云梦县| 陆良县| 永寿县| 阜新| 崇文区| 陆河县| 衡阳市| 平定县| 五原县| 秦皇岛市| 平南县| 光山县| 杂多县| 承德县| 墨脱县| 高安市| 黎平县| 宁都县| 彩票| 玛多县| 三明市| 乌鲁木齐县| 温宿县| 沐川县| 湘潭市| 扎赉特旗| 江口县| 土默特左旗|