Created
April 20, 2018 23:51
-
-
Save mfainshtein2/26651032e9d1938bc39e3ff6cebf1dfb to your computer and use it in GitHub Desktop.
DPS909 lab 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*--- | |
esid: sec-array-constructor-array | |
description: > | |
The Array constructor is a built-in function | |
---*/ | |
var arr = new Array(1,2,3); | |
var reversed = arr.reverse(); | |
assert(compareArray(reversed, [3,2,1]), "Reversed array returned expected value"); | |
arr.push(1); | |
assert(compareArray(reversed, [3,2,1]), "Push didn't affect the reverse array"); | |
var reversed = arr.reverse(); | |
assert(compareArray(reversed, [1,3,2,1]), "now push affected the reverse array"); | |
var arr = new Array(1); | |
var reversed = arr.reverse(); | |
assert(compareArray(reversed, arr), "Should be the same"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment