function checkWinner(arr) {
function Eq(a, b, c) {
return a != 0 && a == b && a == c;
}
for (let i = 0; i < 3; i++) {
// check rows
if (Eq(arr[0][i], arr[1][i], arr[2][i])) {
return arr[0][i]
}
// check cols
if (Eq(arr[i][0], arr[i][1], arr[i][2])) {
return arr[i][0]
}
}
// check diagonal
if (Eq(arr[0][0], arr[1][1], arr[2][2])) {
return arr[0][0]
}
if (Eq(arr[0][2], arr[1][1], arr[2][1])) {
return arr[0][2]
}
return 0
}
Address: 91.108.56.0 01011011.01101100.001110 00.00000000
Netmask: 255.255.252.0 = 22 11111111.11111111.111111 00.00000000
Wildcard: 0.0.3.255 00000000.00000000.000000 11.11111111
=>
Network: 91.108.56.0/22 01011011.01101100.001110 00.00000000
Address: 91.108.57.58 01011011.01101100.001110 01.00111010
Netmask: 255.255.252.0 = 22 11111111.11111111.111111 00.00000000
Wildcard: 0.0.3.255 00000000.00000000.000000 11.11111111
=>
Network: 91.108.56.0/22 01011011.01101100.001110 00.00000000
Network - совпадает, значит они в одной подсети.Address: 91.108.51.1 01011011.01101100.001100 11.00000001
Netmask: 255.255.252.0 = 22 11111111.11111111.111111 00.00000000
Wildcard: 0.0.3.255 00000000.00000000.000000 11.11111111
=>
Network: 91.108.48.0/22 01011011.01101100.001100 00.00000000
Тут сеть отличается. array = [1, 2, 3, 4, 5]
a = 9
if (array.indexOf(a) == -1) {
// not found
}
array = [1, 2, 3, 4, 5]
a = 9
found = false;
for( i = 0; i < array.length; i++ ) {
if (array[i] = a) {
found = true;
console.log("if +");
}
}
if (!found) {
// not found
}
var schedule = [
'Выходной', // Вс
'с 7-30 до 20-00', // Пн
'с 7-30 до 20-00',
'с 7-30 до 20-00',
'с 7-30 до 20-00',
'с 7-30 до 20-00',
'с 7-30 до 18-00', // Сб
];
var now = new Date();
schedule[now.getDay()]
Create a cookie that expires 7 days from now, valid across the entire site:
Cookies.set('name', 'value', { expires: 7 });