Battleship小游戏 —— 《HeadFirst JavaScript Programming》
BattleshipPlaybattleship!varrandomLoc=Math.floor(Math.random()*5);varlocation1=randomLoc;varlocation2=location1+1;varlocation3=location1+2;varguess;varhits=0;varguesses=0;varisSunk=false;while(isSunk=