PHP-функция: array_productСписок php-функций

javascript:

function array_product ( input ) {
	// Вычислить произведение значений массива
	// 
	// +   original by: _argos

	var Index = 0, Product = 1;
	if ( input instanceof Array ) {
		while ( Index < input.length ) {
			Product *= ( !isNaN ( input [ Index ] ) ? input [ Index ] : 0 );
			Index++;
		}
	} else {
		Product = null;
	}

	return Product;
}

//Примеры:

Alert ( array_product([ 2, 4, 6, 8 ]) );

Справочник JavaScript
×
Справочник JavaScript