That is standard Javascript syntax, so it should work.
However, I have found that not all Javascript works the same between iOS, PC, and Android. The three environments do not use the same exact Javascript engine obviously, so some things may not be in one or the other environments (especially true for newer Javascript capabilities). And on my Android phone, the Javacript engine for different apps that support Javascript are also different.
The best thing to do is to do a quick test, and ensure it works like you expect on your device.