Updated JavaScript sample

So it uses auto mode and escapes unicode.