Update Jvascript if-else statements