Fixed invalid javascript in the API examples

Just fixed a small typo.