ShotgunJed Posted June 30, 2017 Share Posted June 30, 2017 The tutorials all use "var" when declaring variables. Is let not allowed to be used in Phaser, or in html5 game development in general? Link to comment Share on other sites More sharing options...
rgk Posted June 30, 2017 Share Posted June 30, 2017 Read this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let http://www.jstips.co/en/javascript/keyword-var-vs-let/ You can use let with phaser and html5 gamedev, but it is es6 so be sure to use babel or only develop for newer browsers. Link to comment Share on other sites More sharing options...
ShotgunJed Posted June 30, 2017 Author Share Posted June 30, 2017 3 minutes ago, rgk said: Read this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let http://www.jstips.co/en/javascript/keyword-var-vs-let/ You can use let with phaser and html5 gamedev, but it is es6 so be sure to use babel or only develop for newer browsers. So to maximise the amount of supported browsers, var should be used instead? Link to comment Share on other sites More sharing options...
alex_h Posted June 30, 2017 Share Posted June 30, 2017 46 minutes ago, ShotgunJed said: So to maximise the amount of supported browsers, var should be used instead? You only want 'var' in the deployed code, you can use const and let in dev and then transpile with babel to convert the code to es5. Depending on which es6 features you use and which browsers you want to support it is getting to the point where transpiling may soon no longer always be necessary though rgk 1 Link to comment Share on other sites More sharing options...
Recommended Posts