javascript syntax is not equal to java syntax