.strictEqual(actual, expected, [message])
Asserts strict equality (===) of actual and expected.
[1, 2, 3] === [1, 2, 3] // false
function countContiguousDistinct(k, arr) {
const counts = [];
let distinct = 0;
const result = [];
for (let i = 0; i < k; i += 1) {
const val = arr[i];
if (counts[val] === undefined) {
counts[val] = 0;
distinct += 1;
}
counts[val] += 1;
}
result.push(distinct);
for (let i = k; i < arr.length; i += 1) {
const lVal = arr[i - k];
counts[lVal] -= 1;
if (counts[lVal] === 0) {
distinct -= 1;
}
const rVal = arr[i];
if (counts[rVal] === undefined) {
counts[rVal] = 0;
}
if (counts[rVal] === 0) {
distinct += 1;
}
counts[rVal] += 1;
result.push(distinct);
}
return result;
}
const today = String((new Date()).getDate()).padStart(2, '0');
const dayStartElements = document.querySelectorAll(".js-text");
dayStartElements.forEach((el) => { el.innerText = `${dd}` });
If the handler throws an error or returns a rejected promise, the promise returned by finally() will be rejected with that value instead. Otherwise, the return value of the handler does not affect the state of the original promise.
...
UnlikePromise.resolve(2).then(() => 77, () => {})
(which will return a resolved promise with the result 77),Promise.resolve(2).finally(() => 77)
will return a new resolved promise with the result 2.
Similarly, unlikePromise.reject(3).then(() => {}, () => 88)
(which will return a resolved promise with the value 88),Promise.reject(3).finally(() => 88)
will return a rejected promise with the reason 3.
But, bothPromise.reject(3).finally(() => {throw 99})
andwill reject the returned promise with the reason 99.Promise.reject(3).finally(() => Promise.reject(99))
function find(sum, n, m) {
if (n === 1) {
return [`${sum}`];
}
const result = [];
const min = Math.max(m, Math.floor(sum - (n - 1) * 9));
const max = Math.floor(sum / n);
for (let i = min; i <= max; i += 1) {
find(sum - i, n - 1, i).forEach((el) => result.push(`${i}${el}`));
}
return result;
}
function findAll(sum, n) {
if (sum > n * 9 || sum < n) {
return [];
}
const result = find(sum, n, 1);
return [result.length, result[0], result.pop()];
}
0x89 0x50 0x4e 0x47 0x0d 0x0a 0x1a 0x0a
или\x89PNG\r\n\x1a\n