// Show flexible assignment of values to arrays function Open_the_door(x, y) { this.x = x; this.y = y } a = new Array( 1, 2.2, 'buckle my shoe', new Array(3,4), new Open_the_door(55.3, 26.8), new Open_the_door('Hi', 'There')) document.write('a[0]= ' + a[0] + '
') document.write('a[1]= ' + a[1] + '
') document.write('a[2]= ' + a[2] + '
') document.write('a[3]= ' + a[3] + '
') document.write('a[4].x= ' +a[4].x + '
') document.write('a[4].y= ' +a[4].y + '
') document.write('a[5].x= ' +a[5].x + '
') document.write('a[5].y= ' +a[5].y + '
') document.write('a[3][0] = ' + a[3][0] + '
') document.write('a[3][1] = ' + a[3][1] + '
') document.write(' Length of a[]= ' + a.length + '
') document.write('

') // Now show associative and sparse arrays b = new Array() b[0] = 'start'; b['house'] = 'myhouse'; b['city'] = 'seattle'; b['county'] = 'King'; b['State'] = "Wash"; b["country"]='USA'; b[9] = 99 document.write('Length of b= ' + b.length + '
') for (value in b) document.write(' b[' + value + ']= ' + b[value] + '
') for (i=0; i<10; i++) document.write(' b['+i+']= ' + b[i] + '
') document.write('

')