javascript api ordering matters