Fixed inconsistencies in JavaScript examples

Fixes #9530 (indentation) and #9513 (trailing semicolons).