from-array.js (955B)
1 // Copyright 2015 Microsoft Corporation. All rights reserved. 2 // This code is governed by the license found in the LICENSE file. 3 4 /*--- 5 description: Passing a valid array 6 esid: sec-array.from 7 ---*/ 8 9 var array = [0, 'foo', , Infinity]; 10 var result = Array.from(array); 11 12 assert.sameValue(result.length, 4, 'The value of result.length is expected to be 4'); 13 assert.sameValue(result[0], 0, 'The value of result[0] is expected to be 0'); 14 assert.sameValue(result[1], 'foo', 'The value of result[1] is expected to be "foo"'); 15 assert.sameValue(result[2], undefined, 'The value of result[2] is expected to equal undefined'); 16 assert.sameValue(result[3], Infinity, 'The value of result[3] is expected to equal Infinity'); 17 18 assert.notSameValue( 19 result, array, 20 'The value of result is expected to not equal the value of `array`' 21 ); 22 23 assert(result instanceof Array, 'The result of evaluating (result instanceof Array) is expected to be true'); 24 25 reportCompare(0, 0);