В 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);
Ответ:
❓Что будет на выходе?
function recursiveMaxSubarraySum(nums, startIndex = 0, currentSum = 0, maxSum = -Infinity) {
if (startIndex === nums.length) {
return maxSum;
}
currentSum = Math.max(nums[startIndex], currentSum + nums[startIndex]);
maxSum = Math.max(currentSum, maxSum);
return recursiveMaxSubarraySum(nums, startIndex + 1, currentSum, maxSum);
}
const result = recursiveMaxSubarraySum([-2, 1, -3, 4, -1, 2, 1, -5, 4]);
console.log(result);Ответ:
❓Что будет на выходе?
const obj = {
0: "zero",
1: "one",
length: 2
};
console.log(Array.from(obj));Ответ:
❓Что будет на выходе?
const map = new Map();
map.set("key", undefined);
console.log(map.has("key"), map.get("key"));
Ответ:
❓Что будет на выходе?
const array = [1, 2, 3, 4];
const result = array.reduceRight((acc, val) => acc - val);
console.log(result);
Ответ:
❓Что будет на выходе?
class Parent {
static greet() {
return 'Hello from Parent';
}
}
class Child extends Parent {
static greet() {
return super.greet() + ' and Child';
}
}
const childInstance = new Child();
console.log(childInstance.greet);Ответ:
❓Что будет на выходе?
class MyClass {
constructor() {
this.a = 10;
}
}
MyClass.prototype.b = 20;
const obj = new MyClass();
delete obj.b;
console.log(obj.b);Ответ: