Created
January 2, 2019 08:30
-
-
Save sealucky7/242993cd4834731d8ec3ca8a1ebc923b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calc( a, b, c) { | |
if ( isNaN(a) ) { | |
console.log("Первый аргумент не число!"); | |
} | |
if ( isNaN(b) ) { | |
console.log("Второй аргумент не число!"); | |
} | |
switch (c) { | |
case '+': | |
return a + b; | |
case '-': | |
return a - b; | |
case '*': | |
return a * b; | |
case '/': | |
return a / b; | |
default: | |
console.log("Передайте один из символов математической операции +, -, * или /"); | |
} | |
} | |
console.log(calc(10, 3, '*')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment