From 1b64251a3e544236fcb4eeb39fdf583175817fba Mon Sep 17 00:00:00 2001 From: Bladymir Tellez Date: Sun, 23 Aug 2020 08:25:41 -0500 Subject: [PATCH] Fix Typos and Smaller Issues --- index.html | 11 +++++++---- scripts/library.js | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 7f69a68..df1992a 100644 --- a/index.html +++ b/index.html @@ -1243,11 +1243,14 @@ function Library (client) { this.len = (item) => { // Returns the length of a list. return item.length } - this.cons = (arr, item) => { // Retruns a new array with the item. - return array.concat([item]) + this.cons = (arr, ...items) => { // Retruns a new array with the items appended. + return arr.concat(items) } - this.push = (arr, item) => { // Appends the item item into the existing list. - return array.push(item) + this.push = (arr, ...items) => { // Appends the items into the existing list. + for (let i = 0; i < items.length; i++) { + arr.push(items[i]) + } + return arr } this.pop = (arr) => { // Pop the last item from the list and return the item. return arr.pop(); diff --git a/scripts/library.js b/scripts/library.js index a7d4ce0..168c499 100644 --- a/scripts/library.js +++ b/scripts/library.js @@ -455,12 +455,15 @@ function Library (client) { return item.length } - this.cons = (arr, item) => { // Retruns a new array with the item. - return array.concat([item]) + this.cons = (arr, ...items) => { // Retruns a new array with the items appended. + return arr.concat(items) } - this.push = (arr, item) => { // Appends the item item into the existing list. - return array.push(item) + this.push = (arr, ...items) => { // Appends the items into the existing list. + for (let i = 0; i < items.length; i++) { + arr.push(items[i]) + } + return arr } this.pop = (arr) => { // Pop the last item from the list and return the item.