Clean up JavaScript sample code