summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Object/replacing-prototype.js
blob: dd6e7d56354c5dac79180343d5eaa89299ef4cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 19.1.1
description: Subclassing Object replacing a prototype method
info: |
  19.1.1 The Object Constructor

  The Object constructor is designed to be subclassable. It may be used as the
  value of an extends clause of a class definition.
---*/

class Obj extends Object {
  valueOf() {
    return 42;
  }
}

var obj = new Obj();

assert.sameValue(obj.valueOf(), 42, 'Replaces prototype');

reportCompare(0, 0);