major failure at figuring out javascript