function array_fill( start_index, num, mixed_val ) { // Fill an array with values // // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: _argos var key, tmp_arr = new Array(); if ( !isNaN ( start_index ) && !isNaN ( num ) ) { for( key = start_index; key <= num; key++ ) { tmp_arr[key] = mixed_val; } } return tmp_arr; }
array_fill(5, 6, 'banana');
Дерево всех статей