TGViewer
JavaScript test JavaScript test @js_test · 9.75K subscribers
Post #6458 443
❗️Что будет на выходе:

function Vehicle(wheels) {
this.wheels = wheels;
}

Vehicle.prototype.getWheels = function() {
return this.wheels;
};

function Car() {
Vehicle.call(this, 4);
this.doors = 4;
}

Car.prototype = Object.create(Vehicle.prototype);
Car.prototype.constructor = Car;

const myCar = new Car();
console.log(myCar.getWheels(), myCar instanceof Vehicle);

Ответ: 4 true

JavaScript test | #JavaScript & Max
More from @js_test
  1. Sep 24, 2026❗️Что будет на выходе: function highlight(strings, ...values) { return strings.reduce((res…
  2. Sep 24, 2026❗️Что будет на выходе: function processData({ a = 10, b = 20 } = { a: 30 }) { console.log(…
  3. Sep 23, 2026❗️Что будет на выходе? const team = { members: ['Alice', 'Bob', 'Charlie'], [Symbol.iterat…
  4. Sep 22, 2026❗️Что будет на выходе: function Animal(name) { this.name = name; } Animal.prototype.speak…
  5. Sep 21, 2026❗️Что будет на выходе: const str = " Hello, World! "; const result = str .trim() .split(",…
  6. Sep 21, 2026❗️Что будет на выходе? async function test() { console.log('1'); setTimeout(() => { consol…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →