From 2a7bb15162bb67217d165a503a52c99aaa34a6a1 Mon Sep 17 00:00:00 2001 From: Philip Ryazankin Date: Mon, 2 Dec 2024 21:27:20 +0300 Subject: [PATCH] add solution for 1-module 1-task --- 01-intro/01-sum/sum.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/01-intro/01-sum/sum.js b/01-intro/01-sum/sum.js index c45d4c3..525b0c7 100644 --- a/01-intro/01-sum/sum.js +++ b/01-intro/01-sum/sum.js @@ -1,3 +1,11 @@ export default function sum(a, b) { - /* ваш код */ + if ( + typeof a === "number" && + isFinite(a) && + typeof b === "number" && + isFinite(b) + ) { + return a + b; + } + throw new TypeError(`Expected two numbers`); }