Recently, I attempted to create a calculator in JavaScript and encountered a requirement to place the button values within single quotes as if they were strings. It's fascinating how these string values can work alongside operators to produce the desired outcome.
Here is a snapshot of the functional code:
<button onclick="
calculation += '1';
console.log(calculation);
">1</button>
<button onclick="
calculation += '2';
console.log(calculation);
">2</button>
I am curious to understand why the values need to be enclosed within quotes resembling a string format.