Version A:
class MainScreen extends Component {
dateArray = [];
datePreparation(){
this.dateArray.push( moment(currentDate).format('YYYY-MM-DD') )
}
}
Version B:
const dateArray = [];
class MainScreen extends Component {
datePreparation(){
dateArray.push( moment(currentDate).format('YYYY-MM-DD') )
}
}
Came across this 2 different way of declaring variable, wondering if there is any significant differences. On version A, why we can't initialize with const/let/var
for variable dateArray