Add showOpponent function in javascript function