@polin11 wrote:
You need to draw a table for playing sea battle. The first line of the list of letters, I did it.
The first vertical column consists of numbers (1,2,3,4,5,6,7,8,9,10), it gave me problems .table-game.js
import Ember from 'ember';
export default Ember.Component.extend({
tableCols:[0,1,2, 3, 4,5,6,7,8,9], //array values can't be changed, must be 0,1,2,3,4,5,6,7,8,9
tableRows:[0,1,2, 3, 4,5,6,7,8,9], //array values can't be changed, must be 0,1,2,3,4,5,6,7,8,9
alpha:['','A','B','C','D','E', 'F','G', 'H', 'I','J'],
});My template table-game.hbs
<table border="1"> {{#each alpha as |row|}} <td class='cell'>{{row}}</td> {{/each}} {{#each tableRows as |singleRow|}} <tr> <td class='cell'>{{singleRow}} </td> <!-- tried so, but the array goes 0,1,2,3,4,5,7,6,8,9 must be 1,2,3,4,5,6,7,8,9,10 --> <!-- is it possible to increase the value {{singleRow}} by 1 ? --> {{#each tableCols as |singleCol|}} <td class='cell'> </td> {{/each}} </tr> {{/each}} </table>
Posts: 1
Participants: 1