1. Use length to clear the array:
< script>
var arr1 = ['aaa','bbbb','http://www.jb51.net'];
alert(arr1);
arr1.length = 0;
alert(arr1); //The array is empty
2. Use length to truncate the array:
< ;script>
var arr1 = ['aaa','bbbb','c','d','e'];
arr1.length = 3;
alert(arr1); // Truncate array aaa,bbbb,c