Debian Codegraph @

js/src/tests/test262/language/statements/class/subclass/builtin-objects/String/regular-subclassing.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 21.1.1
5 description: Subclassing the String object
6 info: |
7 21.1.1 The String Constructor
8
9 ...
10 The String constructor is designed to be subclassable. It may be used as the
11 value of an extends clause of a class definition. Subclass constructors that
12 intend to inherit the specified String behaviour must include a super call to
13 the String constructor to create and initialize the subclass instance with a
14 [[StringData]] internal slot.
15 ---*/
16
17 class S extends String {}
18
19 var s = new S(' test262 ');
20
21 assert.sameValue(s.trim(), 'test262');
22
23
24 reportCompare(0, 0);