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 <zanpaku...@gmail.com> 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
> v8-users@googlegroups.com
> 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 v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
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 v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to