JS API: Fix indents, fix couple of typos and undefined in error.
JS API: Fix indents, fix couple of typos and undefined in error.

zolkis/iotivity-node,zqzhang/iotivity-node,zolkis/iotivity-node,zolkis/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node,zqzhang/iotivity-node,zqzhang/iotivity-node