From 8a9ea57f0144e5e7c6cb14546b72cc6a8062dcb7 Mon Sep 17 00:00:00 2001 From: Harish sambasivam <39916450+harishsambasivam@users.noreply.github.com> Date: Fri, 24 Jul 2020 09:38:56 +0530 Subject: [PATCH] fixed issue with delete operator on stacks (#218) * fixed issue with delete operator using delete operator in arrays ,element remains undefined. so splice is the clean way to do that * Fixed the semicolon and let errors * Update Stack.js --- Data-Structures/Stack/Stack.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data-Structures/Stack/Stack.js b/Data-Structures/Stack/Stack.js index 8be28006a..f95b94059 100644 --- a/Data-Structures/Stack/Stack.js +++ b/Data-Structures/Stack/Stack.js @@ -30,7 +30,7 @@ var Stack = (function () { this.top-- var result = this.stack[this.top] - delete this.stack[this.top] + this.stack = this.stack.splice(0, this.top) return result }