zero-length.js (677B)
1 // Copyright (C) 2015 André Bargull. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-arraybuffer-length 6 description: > 7 The `length` parameter can be zero. 8 info: | 9 ArrayBuffer( length ) 10 11 ... 12 2. Let numberLength be ToNumber(length). 13 3. Let byteLength be ToLength(numberLength). 14 4. ReturnIfAbrupt(byteLength). 15 5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception. 16 ... 17 ---*/ 18 19 var positiveZero = new ArrayBuffer(+0); 20 assert.sameValue(positiveZero.byteLength, 0); 21 22 var negativeZero = new ArrayBuffer(-0); 23 assert.sameValue(negativeZero.byteLength, 0); 24 25 reportCompare(0, 0);