Yes, but there can be a lot more complex cases, just wondering if declaring 
variable faster helps v8 to optimize code faster/cheaper.

On Thursday, February 4, 2016 at 10:37:09 AM UTC+2, Jakob Kummerow wrote:
>
> 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 <zanpa...@gmail.com 
> <javascript:>> 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-u...@googlegroups.com <javascript:>
>> 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+u...@googlegroups.com <javascript:>.
>> 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