skip to Main Content

How to use switch case in React? – Reactjs

const Calculatorpage = () => { function calculate() { const firstNum = Number(document.getElementById('firstNum').value) const secondNum = Number(document.getElementById('secondNum').value) const symbol = document.getElementById('symbol').value const result = document.getElementById('result') console.log("im in"); let res switch (symbol) { case "+": res = secondNumber + firstNumber break;…

VIEW QUESTION
Back To Top
Search