# Restricting length of an array

**URL:** <https://forum.kirupa.com/t/restricting-length-of-an-array/181083>\
**Category:** flash\
**Created:** [March 6, 2006, 10:09am UTC](https://forum.kirupa.com/t/restricting-length-of-an-array/181083 "2006-03-06T10:09:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernel\_flash](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@kernel\_flash](https://forum.kirupa.com/u/kernel_flash)\
**Post date:** [March 6, 2006, 10:09am UTC](https://forum.kirupa.com/t/restricting-length-of-an-array/181083/1 "2006-03-06T10:09:42Z")

</div>

As we have in other languages like C, Java  
that once we define the length of an array we cannot assign any value to the array beyond it’s length.

i.e.  
var ii=new Array(3);  
ii[4]=“asdasdf”;

This kind of stuff is not possible in C and Java.  
However AS2.0 calmly accepts the value and increments the length of ii (array) from 3 to 5.

Is there any means to restrict the array to accept only particular number of data.
