Sums & Accounts

by Amy L

HTML

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div class="jumbotron">
  <h2>Exercise 1</h2>
  <p>Write a function that takes an Array of numbers and returns the sum of all the numbers and the average value. <br />E.g.</p>
  <pre>[1,2,3,4,5,6] => The total is 21 and the average is 3.5</pre>
</div>

<div class="jumbotron">
  <h2>Exercise 2</h2>
  <p>Write a function that returns only the chequing accounts that have a balance of over $100.<br />E.g.</p>
  <pre>(accountList) => Everyday banking, My First Account, Groceries Money</pre>
</div>

JavaScript

// EXERCISE 1:
var inputForExerciseOne = [1, 2, 3, 4, 5, 6];
// TODO: Implement solution



//===========================================================================
// EXERCISE 2:
var inputForExerciseTwo = [
	{ accountId: 1, accountName: 'Simple Chequing', accountType: 'chequing', balance: '53.89'},
  { accountId: 2, accountName: 'Easy Savings', accountType: 'savings', balance: '129.00'},
  { accountId: 3, accountName: 'Everyday banking', accountType: 'chequing', balance: '271.51'},
  { accountId: 4, accountName: 'My First Account', accountType: 'chequing', balance: '123.29'},
  { accountId: 5, accountName: 'Groceries Money', accountType: 'chequing', balance: '478.30'},
  { accountId: 6, accountName: 'For Renovations', accountType: 'savings', balance: '100.50'}
];
// TODO: Implement solution