console.log(true && 5); // 5
console.log(false && 5); // false
console.log(true || 5); // true
console.log(false || 5); // 5
SELECT Images.Path_img, Product.Name, Description.Small_desc, Product.Name
FROM `Images`
JOIN `Product`
JOIN `Description`
JOIN `Popular_product` ON Popular_product.ID_regularProduct = Product.ID;
let i = 2;
nextPrime:
while (i <= 10) {
const limit = Math.sqrt(i);
let j = 2;
while (j <= limit) {
if (i % j === 0) {
j += 1;
i += 1;
continue nextPrime;
}
j += 1;
}
console.log(i);
i += 1;
}
int scanf ( const char * format );
int scanf ( const char * format, argument );
int scanf ( const char * format, argument1, argument2 );
и т.д. $arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
usort(
$arr,
function (int $a, int $b): int {
$result = (($a - 1) % 6) - (($b - 1) % 6);
return $result === 0 ? $a - $b : $result;
}
);
print_r($arr);
/* Array
(
[0] => 1
[1] => 7
[2] => 13
[3] => 2
[4] => 8
[5] => 14
[6] => 3
[7] => 9
[8] => 15
[9] => 4
[10] => 10
[11] => 16
[12] => 5
[13] => 11
[14] => 17
[15] => 6
[16] => 12
[17] => 18
) */
oldArray.sort((a, b) => a.id - b.id);
newArray.sort((a, b) => a.id - b.id);
oldIdx = 0;
newIdx = 0;
while (oldIdx < oldArray.length || newIdx < newArray.length) {
if (oldIdx >= oldArray.length || oldArray[oldIdx].id > newArray[newIdx].id) {
console.log(`Added id newArray[newIdx].id`);
newIdx += 1;
continue;
}
if (newIdx >= newArray.length || oldArray[oldIdx].id < newArray[newIdx].id) {
console.log(`Deleted id oldArray[oldIdx].id`);
oldIdx += 1;
continue;
}
if (oldArray[oldIdx].x !== newArray[newIdx].x) {
console.log(`Changed id newArray[newIdx].id`);
oldIdx += 1;
newIdx += 1;
}
}