From 44384b85d6b5ac2f793a8091a5b3f93086f3076a Mon Sep 17 00:00:00 2001 From: Dimash Date: Wed, 4 Dec 2024 15:44:56 +0500 Subject: [PATCH] feat: add sum func --- 01-intro/01-sum/sum.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/01-intro/01-sum/sum.js b/01-intro/01-sum/sum.js index c45d4c3..d7ec502 100644 --- a/01-intro/01-sum/sum.js +++ b/01-intro/01-sum/sum.js @@ -1,3 +1,7 @@ export default function sum(a, b) { - /* ваш код */ + if (typeof a != 'number' || typeof b != 'number') { + throw new TypeError("Arguments must be numbers"); + } + + return a + b; }