❗️Что будет на выходе?
Ответ:false
JavaScript test | ChatGPT
function Animal() {}
function Dog() {}
Dog.prototype = Object.create(Animal.prototype);
const rover = new Dog();
console.log(rover.hasOwnProperty('constructor'));Ответ:
JavaScript test | ChatGPT
🧠Что будет на выходе?
Ответ:true, true, false, true
JavaScript test | ChatGPT
function Shape() {}
function Circle(radius) {
this.radius = radius;
}
Circle.prototype = Object.create(Shape.prototype);
Circle.prototype.constructor = Circle;
const shape = new Shape();
const circle = new Circle(5);
console.log(circle instanceof Circle);
console.log(circle instanceof Shape);
console.log(shape instanceof Circle);
console.log(shape instanceof Shape);Ответ:
JavaScript test | ChatGPT
❓Что будет на выходе?
Ответ:2
JavaScript test | ChatGPT
var x = 1;
function changeX() { x = 2; }
changeX();
console.log(x);
Ответ:
JavaScript test | ChatGPT
🔥Что будет на выходе?
Ответ:heo word
JavaScript test | ChatGPT
const string = "hello world";
const result = string.replace(/l/g, "");
console.log(result);
Ответ:
JavaScript test | ChatGPT
🧩Что будет на выходе?
Ответ:a1b2c3
JavaScript test | ChatGPT
const obj = { a: 1, b: 2, c: 3 };
let result = "";
for (const [key, value] of Object.entries(obj)) {
result += key + value;
}
console.log(result);Ответ:
JavaScript test | ChatGPT
🧠Что будет на выходе?
Ответ:true
JavaScript test | ChatGPT
const array = [
{ name: 'John', score: 80 },
{ name: 'Jane', score: 95 },
{ name: 'Doe', score: 88 },
];
const result = array.every(obj => obj.score >= 80);
console.log(result);
Ответ:
JavaScript test | ChatGPT
❗️Что будет на выходе?
Ответ:3
JavaScript test | ChatGPT
const a = [1, 2, 3];
const b = a.slice(0, 2).push(4);
console.log(b);
Ответ:
JavaScript test | ChatGPT
❔Что будет на выходе?
Ответ:true true
JavaScript test | ChatGPT
function Person() {}
var person = new Person();
console.log(person instanceof Person);
console.log(person instanceof Object);Ответ:
JavaScript test | ChatGPT
🧩Что будет на выходе?
Ответ:42
JavaScript test | ChatGPT
function X() {}
X.prototype.getValue = function() {
return this.value;
};
function Y() {
this.value = 42;
}
Y.prototype = Object.create(X.prototype);
Y.prototype.constructor = Y;
var y = new Y();
console.log(y.getValue());Ответ:
JavaScript test | ChatGPT
🔨Что будет на выходе?
Ответ:true true
JavaScript test | ChatGPT
function Animal(){
this.type = "animal"
}
function Dog(){
this.name = "dog"
}
Dog.prototype = new Animal()
var PavlovPet = new Dog();
console.log(PavlovPet.__proto__ === Dog.prototype)
console.log(Dog.prototype.__proto__ === Animal.prototype)Ответ:
JavaScript test | ChatGPT
❔Что будет на выходе?
Ответ:[1, 2, 3]
JavaScript test | ChatGPT
function getArr() {
return Array.from(arguments);
}
const result = getArr(...[1, 2, 3]);
console.log(result);Ответ:
JavaScript test | ChatGPT
❗️Что будет на выходе?
Ответ:1 1 2 3
JavaScript test | ChatGPT
function* gen() {
yield *[1,1];
yield 2;
yield 3;
}
const generator = gen();
console.log(generator.next().value);
console.log(generator.next().value);
for (const value of generator) {
console.log(value);
}Ответ:
JavaScript test | ChatGPT
🧩Что будет на выходе?
Ответ:2
JavaScript test | ChatGPT
function A() {}
A.prototype.value = 1;
function B() {}
B.prototype = new A();
B.prototype.value = 2;
var b = new B();
console.log(b.value);Ответ:
JavaScript test | ChatGPT
🤯Что будет на выходе?
Ответ:a, b
JavaScript test | ChatGPT
let obj = { a: 1 };
let proto = { b: 2 };
Object.setPrototypeOf(obj, proto);
for (let key in obj) {
console.log(key);
}Ответ:
JavaScript test | ChatGPT
🧠Что будет на выходе?
Ответ:[0, 2, 3]
JavaScript test | ChatGPT
const a = [1, 2, 3];
const b = a;
b[0] = 0;
console.log(a);
Ответ:
JavaScript test | ChatGPT
🧩Что будет на выходе?
Ответ:true, 2, 1
JavaScript test | ChatGPT
let obj = { a: 1 };
Object.freeze(obj);
console.log(Object.isFrozen(obj));
console.log(obj.a = 2);
console.log(obj.a);Ответ:
JavaScript test | ChatGPT
❗️Что будет на выходе?
Ответ:-35
JavaScript test | ChatGPT
let x = 10;
let y = 5;
x += y -= x *= y;
console.log(x);
Ответ:
JavaScript test | ChatGPT
❕Что будет на выходе?
Ответ:Hello, my name is John
JavaScript test | ChatGPT
function Person(name) {
this.name = name;
}
Person.prototype.greet = function() {
return `Hello, my name is ${this.name}`;
};
const john = new Person('John');
console.log(john.greet());Ответ:
JavaScript test | ChatGPT