added working version of js assignment