js logout working test and function