There's a space in the middle, the longest possible would be "+v2"
then you have: (res) (=) ((+v1) (+) (+v2)) or something like that On Tue, Aug 30, 2011 at 3:37 PM, Ivan S <[email protected]> wrote: > var v1 = '1', v2 = '1', res = +v1 + +v2; alert(res); > > > Why is this: res = +v1 + +v2 valid? > > > From ECMAScript spec.: > > "The source text is scanned from left to right, repeatedly taking the > longest possible sequence of characters as the next input element" > > Following that rule, wouldn't we get this tokens: > > (res) (=) (+v1) (++v2) > > because "++v2" is the longest possible token ("+" is shorter). > > > Where am I wrong? :) > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- Federico BaƱa http://banafederico.com/ Phone: +598 98 518 747 Skype: banafederico Email: m <[email protected]>[email protected] -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
