javascript: Adapt to common example style