Shouldn't make a difference in most cases. Personally, I'd go for: 3) var x = value ? 2 : 1;
which, per the JavaScript spec, is semantically equivalent to (1) anyway, but more concise. On Wed, Feb 3, 2016 at 9:16 PM, Arthur Shefer <[email protected]> wrote: > Hello, fast question - what is the best approach for v8 when declaring > variables and final value is only known after processing but with known > type? > > 1) var x; > x = value ? 2 : 1; > > 2) var x = 0; > x = value ? 2 : 1; > > -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
