arrayDivisionToScalar function

Array arrayDivisionToScalar(
  1. Array a,
  2. num b
)

Divide all the array elements for a number

Examples

var list = Array([4.0, 8.0 , 16.0]);

print(arrayDivisionToScalar(list, 2));

/* expected output:
Array([2.0, 4.0, 8.0])
*/

Implementation

Array arrayDivisionToScalar(Array a, num b) {
  var c = Array.fixed(a.length);
  for (var i = 0; i < a.length; i++) {
    c[i] = a[i] / b;
  }
  return c;
}