Board state representation
In order to draw the board, we need a matrix that has 5 columns and 6 rows:
@property() matrix: string[][] = [
['h', 'e', 'l', 'l', 'o'],
['t', 'e', 's', 't', 's'],
[],
[],
[],
[],
];Loop throught the matrix
Now that we have our state in place we need to display it on screen. For that map is perfect:
import { map } from 'lit/directives/map.js';
render() {
return map(
this.matrix,
row =>
html`<div>
${map(row, letter =>
html`<span>
${letter}
</span>`)}
</div>`
);
}result