I try this example given below for looping using for loop in normal js file and in reactjs.
for(var a=[i=0];++i<20;a[i]=i);
when i run this code in react it shows
'i' is not defined
import React, { Component } from 'react';
import './App.css';
export default class Board extends Component
{
move (e)
{
for(var a=[i=0];++i<20;a[i]=i);
console.log(a)
}
render () {
return (
<div className="boxes" onClick={this.move.bind(this)}></div>
);
}
}
when i run it in the normal js file it works fine.any ideas why it happens in reactjs.
