Skip to content

Commit

Permalink
Merge pull request #4102 from miquelangelamengual/main
Browse files Browse the repository at this point in the history
Reto #28 - typescript
  • Loading branch information
kontroldev authored Jul 12, 2023
2 parents 554c43f + fb54a84 commit f76bb3f
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"));

0 comments on commit f76bb3f

Please sign in to comment.