function freezeArray(input) {
  var array = [];
  var l = input.length;
  for (var i = 0; i < l; i++) {
    if (i in input) {
      %object_define_property(array, i, {value: input[i],
                                         configurable: false,
                                         writable: false,
                                         enumerable: true});
    }
  }

  %object_define_property(array, 'length', {value: l, writable: false});
  return array;
}
function freezeArray(input) {
  var array = [];
  var l = input.length;
  for (var i = 0; i < l; i++) {
    if (i in input) {
      %object_define_property(array, i, {value: input[i],
                                         configurable: false,
                                         writable: false,
                                         enumerable: true});
    }
  }

  %object_define_property(array, 'length', {value: l, writable: false});
  return array;
}
function freezeArray ( input ) { var array = [ ] ; var l = input . length ; for ( var i = 0 ; i < l ; i ++ ) { if ( i in input ) { % object_define_property ( array , i , { value : input [ i ] , configurable : false , writable : false , enumerable : true } ) ; } } % object_define_property ( array , 'length' , { value : l , writable : false } ) ; return array ; }
Given an array-like, outputs an Array with the numbered
properties copied over and defined
configurable: false, writable: false, enumerable: true.
Given an array - like outputs an Array with the numbered properties copied over and defined configurable : false writable : false enumerable : true .