build-your-own-angularjs
build-your-own-angularjs copied to clipboard
p199 potential missing consideration when parsing numbers?
book p199 ended up the parsing numbers part.
But how about the following test case:
it('can parse plus number', function() {
var fn = parse('+2');
expect(fn()).toBe(2);
});
I already noticed on page 194 said:
You may have noticed we’re only considering positive integers here. That is because we will handle negative numbers differently, by considering the minus sign as an operator instead of being part of the number itself.
But why didn't we consider about "+3" -> 3 case? Or am I wrong or sth?
BTW, thanks for your work, cheers!