Hello,
I am wondering what you could possibly answer to the question in the title?
Personally I like my little calculator but it's not OOP (but some people says everything is OOP in JS)
********************************************************************
const operator = prompt('Enter operator ( either +, -, * or / ): ');
const number1 = parseFloat(prompt("Enter first number:"));
const number2 = parseFloat(prompt("Enter second number:"));
let result;
if (operator == '+') {
result = number1 + number2;
}
else if (operator == '-') {
result = number1 - number2;
}
else if (operator == '*') {
result = number1 * number2;
}
else {
result = number1 / number2;
}
console.log(result);
********************************************************************
And you what small program (30 lines max) would you write for such a question? Something practical.
No HTML/No CSS
I am wondering what you could possibly answer to the question in the title?
Personally I like my little calculator but it's not OOP (but some people says everything is OOP in JS)
********************************************************************
const operator = prompt('Enter operator ( either +, -, * or / ): ');
const number1 = parseFloat(prompt("Enter first number:"));
const number2 = parseFloat(prompt("Enter second number:"));
let result;
if (operator == '+') {
result = number1 + number2;
}
else if (operator == '-') {
result = number1 - number2;
}
else if (operator == '*') {
result = number1 * number2;
}
else {
result = number1 / number2;
}
console.log(result);
********************************************************************
And you what small program (30 lines max) would you write for such a question? Something practical.
No HTML/No CSS