Updated code samples for JS