updated sample program as .js file