-
-
Save NevermindKT/baa55abe8a8abfc7bee7df2495d6b98a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//----------------------------------------111 1 | |
const comparaison = (a, b) => { | |
if (a < b) return -1; | |
if (a > b) return 1; | |
return 0; | |
} | |
//-----------------------------------------222 3 | |
const stringSum = (...numbers) => numbers.reduce((a, x) => a + x, 0).toString(); | |
//-----------------------------------------333 4 | |
const squareAndRectangle = (...args) => { | |
if (args.length === 1) | |
return args[0] * 4; | |
if (args.length === 2) | |
return (args[0] + args[1]) * 2; | |
} | |
//-----------------------------------------444 13 | |
function calculate(a, b, sign) { | |
switch (sign) { | |
case '+': | |
return a + b; | |
case '-': | |
return a - b; | |
case '*': | |
return a * b; | |
case '/': | |
return a / b; | |
} | |
} | |
//------------------------------------------555 17 | |
const sumAll = (...args) => args.reduce((a, x) => a + x, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment