js formatting in JSAPI