figuring out javascript