I'm building a calculator to test out my Vue JS skills. I have the fundamentals working or at least set-up, however if I enter more than one number (e.g. 34
) I can't get it to read all numbers (e.g. 34
) as a whole value; rather it adds 3 and 4 to the total. The snippet I'm having trouble with is here:
press: function(num) {
if(this.currentNum == 0)
{
this.currentNum = num;
this.output = num.toString();
}
else {
this.output += num.toString();
this.currentNum = this.output.parseInt();
}
},
Here's the whole thing on CodePen for better context - https://codepen.io/ajm90UK/pen/BZgZvV
I think this is more of a JS issue rather than anything specific to Vue but even with parseInt() on the string I'm having no luck. Any suggestions on how I can read the display (output) would be greatly appreciated, I've been at this for hours now!