Learn Functional Programming by Building a Spreadsheet - Step 17

Tell us what’s happening:

I don’t understand the instruction of this step:
" You should set the id attribute of your input element to letter + number ."

Does it mean literally set

 input.id = 'letter + number'

Or to use template literal to set

input.id = `${letter}  + ${number}`

I’ve tried both ,but failed again and again.

PLEASE tell me what’s the problem.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
    <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>
    <div id="container">
    <script src="./script.js"></script>
/* file: styles.css */
#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;
/* file: script.js */
const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index);
const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code));

window.onload = () => {
  const container = document.getElementById("container");
  const createLabel = (name) => {
    const label = document.createElement("div");
    label.className = "label";
    label.textContent = name;
  const letters = charRange("A", "J");
  range(1, 99).forEach(number => {

/* User Editable Region */

    letters.forEach(letter => {
const input = document.createElement('input');
input.type = 'text';
input.id='letter + number';

/* User Editable Region */


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 17

the id attribute to letter + number.

letter is a variable and number is a variable, I would take this instruction entirely literally. You don’t want to set it to a string letter + number. It doesn’t say anything about a string, or string literal.

As said, it is just the two variables

input.id = var1 + var2

As an aside, I’m not sure if this has been explained but HTML attributes that use hyphens are camel case as properties. E.g. aria-hidden would be ariaHidden as a property.

It is possible to set hyphen values using the setAttribute method, but this challenge will not allow for that (as far as I can tell).

hi @lasjorg and @liangnuanhui I am also ‘stuck’ on step17! the instructions state, “set Attribute”
this is my code; and the error message given.
" You should set the aria-label attribute of your input element to letter + number."
letters.forEach(letter => { const input = document.createElement('input'); input.type = 'text'; input.id = letter + number; input.setAttribute("aria-label", letter + number); })

after reading more about ‘aria-label’ accessibility from MDN, the solution is
input.ariaLabel = letter + number;