# Lab05

```function multiplyArray(multArr) {
let product = multiply(multArr[0],multArr[1])[0] * multArr[2];
return [product,`The numbers \${multArr[0]},\${multArr[1]},\${multArr[2]} have a product of \${product}.`]
}

testMultiplyArray(testArray);```
```function sum(a, b) {
let z = a + b;

return [z, 'The sum of ' + a +' and ' + b + ' is ' + z + '.'];
}
testSum(4, 7);```
```function multiply(a, b) {
let z = a * b;

return [z, 'The product of ' + a +' and ' + b + ' is ' + z + '.'];
}
testMultiply(5,9);```
```function sumAndMultiply(a, b, c) {
let add = sum(a,b)[0] + c;
let product = multiply(a,b)[0] * c;

return [add,product,`\${a} and \${b} and \${c} sum to \${add}.`,`The product of \${a} and \${b} and \${c} is \${product}.`]
}

testSumAndMultiply(4,7,5);```
```let testArray = [2, 3, 4];

function sumArray(sumArr) {
let add = sum(sumArr[0],sumArr[1])[0] + sumArr[2];
return [add,`\${sumArr[0]},\${sumArr[1]},\${sumArr[2]} was passed in as an array of numbers, and \${add} is their sum.`]
}

testSumArray(testArray);```
```function sumAndMultiply(a, b, c) {
let summation = sum(sum(a,b)[0],c)[0];
let multiplication= multiply(multiply(a,b)[0],c)[0];
return [summation,multiplication, `\${a} and \${b} and \${c} sum to \${summation}.`, `The product of \${a} and \${b} and \${c} is \${multiplication}.`]
}
testSumAndMultiply(4,7,5);```