Created JS logic to play