subclassable.js (763B)
1 // Copyright (C) 2020 Rick Waldron. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-iterator-constructor 6 description: > 7 The Iterator constructor is designed to be subclassable. 8 info: | 9 The Iterator constructor 10 11 - is designed to be subclassable. It may be used as the value of an extends clause of a class defintion. 12 13 features: [iterator-helpers] 14 ---*/ 15 16 class SubIterator extends Iterator {} 17 18 assert.sameValue( 19 new SubIterator() instanceof SubIterator, 20 true, 21 'The result of `(new SubIterator() instanceof SubIterator)` is true' 22 ); 23 assert.sameValue( 24 new SubIterator() instanceof Iterator, 25 true, 26 'The result of `(new SubIterator() instanceof Iterator)` is true' 27 ); 28 29 reportCompare(0, 0);