operator = '';
numTwo = '';
} else {
alert('숫자를먼저입력하세요.');
}
};
const onClickOperator = (op) => () => {
if (numTwo) {
calculate();
operator = op;
$operator.value = op;
} else if (numOne) {
operator = op;
$operator.value = op;
} else {
alert('숫자를먼저입력하세요.');
}
};
document.querySelector('#plus').addEventListener('click', onClickOperator('+'));
document.querySelector('#minus').addEventListener('click', onClickOperator('-'));
document.querySelector('#divide').addEventListener('click', onClickOperator('/'));
document.querySelector('#multiply').addEventListener('click', onClickOperator('*'));
document.querySelector('#calculate').addEventListener('click', calculate);