Created
July 28, 2020 13:11
-
-
Save az67128/3cde673aa99d1798c69872f8bc927439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Напишите функцию sum, которая бы работала следующим образом: | |
sum(1)(2) == 3; // 1 + 2 | |
sum(1)(2)(3) == 6; // 1 + 2 + 3 | |
sum(5)(-1)(2) == 6; | |
sum(6)(-1)(-2)(-3) == 0; | |
sum(0)(1)(2)(3)(4)(5) == 15; | |
// Вызовите функцию test, передав такую функцию, чтобы в результате в консоли приложения было выведено | |
// test 1 | |
// test 2 | |
// test 3 | |
function test(fn) { | |
fn(); | |
setTimeout(() => console.log("test 3"), 0); | |
console.log("test 1"); | |
} | |
// Напишите полифил для функции Promise.allSettled() | |
const promise1 = Promise.resolve(3); | |
const promise2 = new Promise((resolve, reject) => setTimeout(reject, 100, "foo")); | |
const promises = [promise1, promise2]; | |
Promise.allSettled(promises).then((results) => console.log(results)); | |
// [{"status":"fulfilled","value":3},{"status":"rejected","reason":"foo"}] | |
// Написать функцию, которая проверяет, является ли переданная строка палиндромом | |
// "A man, a plan, a canal: Panama" | |
// Output: true | |
// Input: "race a car" | |
// Output: false | |
const isPalindrome = function(s) { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment