Created
March 15, 2018 21:38
-
-
Save PatMB30/7a483999a2986b8358c4155d74c587e8 to your computer and use it in GitHub Desktop.
testing the comparison and reversing if middle element is non-numerical
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
// Copyright (C) 2015 Patrick G. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
info: arrayComparison reorders the elements of the array in reverse using Array.reverse | |
description: testing the comparison and reversing if middle element is non-numerical | |
---*/ | |
var arr1 = [2,4,"string",6,8]; | |
var arr1Copy = arr1.reverse(); | |
var arr2 = [1,3,"string2",5,7]; | |
////////////////////////////////////////////////////////////////////////////////// | |
//CHECK 1 | |
assert.sameValue(arr1Copy[0], 8, "arr1Copy[0] === 8"); | |
assert.sameValue(arr1Copy[1], 6, "arr1Copy[1] === 6"); | |
assert.sameValue(arr1Copy[3], 4, "arr1Copy[3] === 4"); | |
assert.sameValue(arr1Copy[4], 2, "arr1Copy[4] === 2"); | |
////////////////////////////////////////////////////////////////////////////////// | |
//CHECK 2 | |
assert.sameValue(arr1Copy, arr1, "returns the same object"); | |
////////////////////////////////////////////////////////////////////////////////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment