Files

2.5 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
642df9df4b5216350de7b0d2 Step 6 0 step-6

--description--

You will need a function to generate a range of numbers.

Declare an empty range function which takes a start and end parameter. Use the Array() constructor and implicitly return an empty array.

--hints--

You should declare a range variable.

assert.match(code, /(?:let|var|const)\s+range/);

You should use const to declare your range variable.

assert.match(code, /const\s+range/);

Your range variable should be a function.

assert.isFunction(range);

Your range function should use arrow syntax.

assert.match(code, /const\s+range\s*=\s*\(.*\)\s*=>/);

Your range function should take a start parameter first.

assert.match(code, /const\s+range\s*=\s*\(\s*start/)

Your range function should take an end parameter second.

assert.match(code, /const\s+range\s*=\s*\(\s*start\s*,\s*end\s*\)/);

Your range function should use an implicit return. Remember that this means you will not use curly brackets.

assert.notMatch(code, /const\s+range\s*=\s*\(\s*start\s*,\s*end\s*\)\s*=>\s*{/);

Your range function should use the Array() constructor. Primitive constructors do not need the new keyword.

assert.match(code, /const\s+range\s*=\s*\(\s*start\s*,\s*end\s*\)\s*=>\s*Array\(/);

You should not pass anything to the Array() constructor.

assert.match(code, /const\s+range\s*=\s*\(\s*start\s*,\s*end\s*\)\s*=>\s*Array\(\s*\)/);

--seed--

--seed-contents--

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="./styles.css" />
    <title>Functional Programming Spreadsheet</title>
  </head>
  <body>
    <div id="container">
      <div></div>
    </div>
    <script src="./script.js"></script>
  </body>
</html>
#container {
  display: grid;
  grid-template-columns: 50px repeat(10, 200px);
  grid-template-rows: repeat(11, 30px);
}

.label {
  background-color: lightgray;
  text-align: center;
  vertical-align: middle;
  line-height: 30px;
}
--fcc-editable-region--

--fcc-editable-region--

window.onload = () => {
  const container = document.getElementById("container");
  const createLabel = (name) => {
    const label = document.createElement("div");
    label.className = "label";
    label.textContent = name;
    container.appendChild(label);
  }
}