Добрый день. Не могу придумать функцию по определению выигравшего Х или 0. Прошу помощи.
<!DOCTYPE>
<html>
<head>
<title>Крестики-нолики</title>
<meta charset="utf-8">
</head>
<body>
<form>
<table height="" width="" border="0">
<tr>
<td> <input type="button" name="b1" value="" onclick="event_b1(this)"> </td>
<td> <input type="button" name="b2" value="" onclick="event_b1(this)"> </td>
<td> <input type="button" name="b3"value="" onclick="event_b1(this)"> </td>
</tr>
<tr>
<td><input type="button" name="b4"value="" onclick="event_b1(this)"></td>
<td><input type="button" name="b5"value="" onclick="event_b1(this)"></td>
<td><input type="button" name="b6"value="" onclick="event_b1(this)"></td>
</tr>
<tr>
<td><input type="button" name="b7"value="" onclick="event_b1(this)"></td>
<td><input type="button" name="b8"value="" onclick="event_b1(this)"></td>
<td><input type="button" name="b9"value="" onclick="event_b1(this)"></td>
</tr>
</table>
</form>
<script>
let hod = 0;
function event_b1 (button){
if(button.value) return;
button.value = hod++ % 2 ? "0" : "X";
}
function winning(){
if (button.b1.value == "X" && button.b2.value == "X" && button.b3.value == "X"||button.b4.value == "X" && button.b5.value == "X" && button.b6.value == "X"||button.b7.value == "X" && button.b8.value == "X" && button.b9.value == "X"||button.b1.value == "X" && button.b5.value == "X" && button.b9.value == "X"||button.b2.value == "X" && button.b5.value == "X" && button.b8.value == "X"||button.b3.value == "X" && button.b6.value == "X" && button.b9.value == "X"||button.b3.value == "X" && button.b5.value == "X" && button.b7.value == "X")
{alert("Выиграли X");}
else
{button.b1.value == "0" && button.b2.value == "0" && button.b3.value == "0"||button.b4.value == "0" && button.b5.value == "0" && button.b6.value == "0"||button.b7.value == "0" && button.b8.value == "0" && button.b9.value == "0"||button.b1.value == "0" && button.b5.value == "0" && button.b9.value == "0"||button.b2.value == "0" && button.b5.value == "0" && button.b8.value == "0"||button.b3.value == "0" && button.b6.value == "0" && button.b9.value == "0"||button.b3.value == "0" && button.b5.value == "0" && button.b7.value == "0"
}
{alert("Выиграли 0");}
</script>
</body>
</html>