offline version 0.0.2


Building a field in the find the number game in JavaScript

In the previous lesson, I described the build function, which will receive as parameters a reference to the playing field and a two-dimensional array with random numbers returned by the prepare function.

Our build function will form table cells filling them with numbers from the array. For example, using our functions, we can create an initial 2 by 2 table like this:

build(field, prepare(2));

Here is a draft of the described function:

function build(field, arr) { }

Write an implementation of this function.

Modify your function to return an array of generated table cells:

let cells = build(field, prepare(2)); console.log(cells);

Modify your function to clear the table's textContent before creating a field in it.

enru