From fb54a84f2a27df34e826c324cf44a7ca30215d6f Mon Sep 17 00:00:00 2001 From: Miquel Angel Date: Wed, 12 Jul 2023 18:44:54 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20a=C3=B1adir=20mi=20resultado=20del=20re?= =?UTF-8?q?to=20#28=20con=20typescript?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../typescript/miquelangelamengual.ts" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "Retos/Reto #28 - EXPRESI\303\223N MATEM\303\201TICA [Media]/typescript/miquelangelamengual.ts" diff --git "a/Retos/Reto #28 - EXPRESI\303\223N MATEM\303\201TICA [Media]/typescript/miquelangelamengual.ts" "b/Retos/Reto #28 - EXPRESI\303\223N MATEM\303\201TICA [Media]/typescript/miquelangelamengual.ts" new file mode 100644 index 0000000000..1bcbce94b4 --- /dev/null +++ "b/Retos/Reto #28 - EXPRESI\303\223N MATEM\303\201TICA [Media]/typescript/miquelangelamengual.ts" @@ -0,0 +1,11 @@ +const checkMathExpression = (expression: string): boolean => { + try { + eval(expression); + return true; + } catch (error) { + return false; + } +}; + +console.log(checkMathExpression("5 + 6 / 7 - 4")); +console.log(checkMathExpression("5 a 6"));