let arr=[]
for(let i=2;i<=10;i=i+2){
arr[i]=[]
for(let j=1;j<=20;j=j+2){
arr[i][j]=i*j;
}
console.log(`\n`);
}
console.table(arr);
https://stackoverflow.com/questions/ask#
**This Code Correct in JavaScript, But No Idea in React-JS
enter code here
This is a simple table example using map()
The map() method builds the table by looping through all items of the array and returning HTML with the index and string of each array item.
HTML returned by map()
<tr key={index}>
<td>
{index}
</td>
<td>
{str}
</td>
</tr>
Try the following snippet
function App(){
const myArray = ['item zero', 'item one', 'item two']
return[
<table key='table-key'>
<thead>
<tr>
<th>index</th>
<th>string</th>
</tr>
</thead>
<tbody>
{myArray.map((str, index) => {
return[
<tr key={index}>
<td>
{index}
</td>
<td>
{str}
</td>
</tr>
]
})}
</tbody>
</table>
]
}
ReactDOM.render(<App/>, document.getElementById("root"));
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="root"/>