samples code for javascript