We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pour calculatrice les deux propositions ci-dessous peuvent-elles être envisagées ?
function calculer(a, string, b) { if (string == "+") { return a + b; } else if (string == "-") { return a - b; } else if (string == "*") { return a * b; } else if (string == "/") { return a / b; } } console.log(calculer(4, "+", 6)); // Doit afficher 10 console.log(calculer(4, "-", 6)); // Doit afficher -2 console.log(calculer(2, "*", 0)); // Doit afficher 0 console.log(calculer(12, "/", 0)); // Doit afficher Infinity
//2ème possibilité sous toute réserve function calculer(a, string, b) { return eval(a + string + b); } console.log(calculer(4, "+", 6)); // Doit afficher 10 console.log(calculer(4, "-", 6)); // Doit afficher -2 console.log(calculer(2, "*", 0)); // Doit afficher 0 console.log(calculer(12, "/", 0)); // Doit afficher Infinity
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Pour calculatrice les deux propositions ci-dessous peuvent-elles être envisagées ?
The text was updated successfully, but these errors were encountered: