Javascript `let` make black screen after splash on iOS

#1

Hi,

I am developing with a small team an hybrid app based on Ionic v1. We have created a new page on it and everything seemed to be OK (at least on Android it is right).

When I compiled for iOS (iPad), a black screen appears after splash but none error message in console while debugging.
After moving between different commits on our repo and recompiling, recompiling … I could find that the error came when using let to declare a variable in javascript side (controller). It is the first time we used let in the app.
Changing every let for var, the black screen disappeared and everything works perfectly right now.

Anyone knows why? what is wrong between the use of let and iOS in an Ionic framework development?

I would appreciate any suggest,
Thank you.

#2

I think you should prefer let to var in virtually every situation, and if you have code that doesn’t work that way, I would restructure it so that it does, because it will be much more readable and maintainable. To understand the difference and JavaScript scoping rules in general, I would start here.

#3

Yes, I understand the differences between let and var and why we should prefer let. Moreover, we use let in some other projects.

What I don’t understand is why using let instead of var (or nothing) makes the app be a black screen in iOS devices, just after splash.
Note: after splash, used controller is not the one with let… ¿?