-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtail.js
27 lines (17 loc) · 821 Bytes
/
tail.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const assertEqual = require("./assertEqual");
const tail = function (compareValue) {
let result = Array.from(compareValue);
result.shift();
return result;
}
module.exports = tail;
// // // Test Case 1: Check the returned array elements
// const result = ["Hello", "Lighthouse", "Labs"];
// let newResult = tail(result);
// assertEqual(newResult.length, 2); // ensure we get back two elements
// assertEqual(newResult[0], "Lighthouse"); // ensure first element is "Lighthouse"
// assertEqual(newResult[1], "Labs"); // ensure second element is "Labs"
// // Test Case: Check the original array
// const words = ["Yo Yo", "Lighthouse", "Labs"];
// tail(words); // no need to capture the return value since we are not checking it
// assertEqual(words.length, 3); // original array should still have 3 elements!