❓Что будет на выходе?
Ответ:false, true, false
JavaScript test
const regex = /^(?!cat).+$/;
console.log(regex.test('cat'), regex.test('dog'), regex.test('category'));
Ответ:
JavaScript test
❓Что будет на выходе?
Ответ:undefined
JavaScript test
const obj = { a: 1 };
Object.seal(obj);
obj.b = 2;
console.log(obj.b);Ответ:
JavaScript test
❓Что будет на выходе?
Ответ:true, true, false
JavaScript test
const regex = /a/i;
console.log(regex.test('A'), regex.test('a'), regex.test('b'));
Ответ:
JavaScript test
❓Что будет на выходе?
Ответ:World, Hello
JavaScript test
const regex = /(\w+)\s(\w+)/;
const str = 'Hello World';
const result = str.replace(regex, '$2', '$1');
console.log(regex);
Ответ:
JavaScript test
❓Что будет на выходе?
Ответ:undefined
JavaScript test
const obj = {
a: 1,
b: function() {
return this.a;
}
};
const b = obj.b;
console.log(b());Ответ:
JavaScript test
В 2024 году на кодинге уже не вывезешь, перспектива года - Информационная Безопасность.
Ловите полезные каналы, которые помогут ворваться в новое направление.
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥Что будет на выходе?
Ответ:"uoeaoooe"
JavaScript test | ChatGPT | #JavaScript
const string = "Hello, World! How are you?";
const result = [...string.matchAll(/[aeiou]/g)]
.map(match => match[0])
.reverse()
.join("");
console.log(result);
Ответ:
JavaScript test | ChatGPT | #JavaScript
🔥Что будет на выходе?
Ответ:45
JavaScript test | #JavaScript
var x = 87
function part1() {
x = 45
}
function part2() {
alert(x)
}
part1()
part2()
Ответ:
JavaScript test | #JavaScript
🔥Что будет на выходе?
Ответ:[1, 2]
JavaScript test | #JavaScript
function* gen() {
yield 1;
yield 2;
return 3;
}
const g = gen();
console.log([...g]);Ответ:
JavaScript test | #JavaScript
❓Что будет на выходе?
const person = {
name: "John",
greet: function() {
const getMessage = () => `Hello, ${this.name}`;
return getMessage();
}
};
console.log(person.greet());Ответ:
❓Что будет на выходе?
const baseObject = {x: 1, y: 2};
const extendedObject = {...baseObject, z: 3};
const result = { ...extendedObject, x: 4 };
console.log(result);Ответ:
❓Что будет на выходе?
const nums = [1, 2, 3];
const res = nums.reduce((acc, val) => acc + val, "");
console.log(typeof res);
Ответ:
❓Что будет на выходе?
const a = { a: 1 };
const b = Object.seal(a);
b.a = 2;
console.log(a.a);Ответ:
❓Что будет на выходе?
console.log(+true);
console.log(!"frontendlob");
Ответ:
❓Что будет на выходе?
(async function() {
return await 10;
})().then(console.log);Ответ:
❓Что будет на выходе?
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 1000);
}Ответ:
❓Что будет на выходе?
function foo() {}
foo.prototype.bar = 42;
const obj = new foo();
foo.prototype = { bar: 100 };
console.log(obj.bar);Ответ:
❓Что будет на выходе?
function nums(a, b) {
if (a > b)
console.log('a > b')
else
console.log('b > a')
return
a + b
}
console.log(nums(6, 3))
console.log(nums(2, 4))Ответ:
undefined
b > a
undefined
❓Что будет на выходе?
function* gen() {
yield 1;
yield 2;
yield 3;
}
async function asyncFunc() {
for (let value of gen()) {
await new Promise(res => setTimeout(res, 100));
console.log(value);
}
return 'done';
}
const result = asyncFunc();
console.log(result instanceof Promise);Ответ:
❓Что будет на выходе?
const string = "open sesame";
const result = string.split(" ").map(word => word.length);
console.log(result);
Ответ: