title: Using JavaScript eval() function for basic calculator
body: <p>I am thinking about coding a basic calculator with UI so HTML and CSS. I thought if I can write something like this I can do this project.</p>
  <pre><code>const plusFn = function(){
    const sign = '+'
    inputUser.textContent += sign
  
    const equalFn = function(){
      const input = `${inputUser.value}`
      const numbers = input.split(`${sign}`)
      const result = eval(`${+numbers[0]}${sign}${+numbers[1]}`)
    }
    btnEqual.addEventListener('click',equalFn)
  }
  
  btnPlus.addEventListener('click',plusFn)
  </code></pre>
  <p>Let's assume our user pressed 123 and wrote it to input area, then pressed +, from now on he trigerred the plusFn which determines a specific operator and adding a new event listener for equality button. When he gives second number and presses the equality button, operating will work as upside. Is it safe ? I read eval function is very dangerous but I couldn't think any alternative.</p>