ga-wdi-boston / js-array-iteration-methods

JavaScript Array methods
Other
1 stars 160 forks source link

Add files as scaffolding. #24

Closed gaand closed 7 years ago

gaand commented 8 years ago

At least these:

Others?

For the example data, at least these:

'use strict';

const whole = new Array(11).fill(1).map((e, i, a) => e * i);
const even = new Array(11).fill(2).map((e, i, a) => e * i);
const odd = new Array(11).fill(2).map((e, i, a) => (e * i) + 1);
const fibonacci = ((f0, f1, count) => {
  let fibs = [f0, f1];
  for (let i = 2; i < count; i++) {
    fibs[i] = fibs[i-1] + fibs[i-2];
  }
  return fibs;
})(0, 1, 11);

module.exports = {
  even,
  odd,
  fibs,
};

And that can be required by the code runners.

Some none numeric examples would be good, too.