real use of {const} and issues

Fyodorov "Bga" Alexander bga.email at gmail.com
Tue May 31 04:32:08 PDT 2011


my view of {const} keyword semantic
1) alloced 1 time, as {var}, for correct work of closure
2) assign w/o {const} redeclaration - (not silent) error
3) assign w/ {const} redeclaration - change value
and small code, reason

var i = vs.length; while(i--)
{
  const v = vs[i] // one alloc but many assigns
  v = 1 // assign w/o {const} keyword - error
}

-- 
Alexander.


More information about the es-discuss mailing list