Change id to index, add js type to example code block

Signed-off-by: Eli Skeggs <skeggse@gmail.com>