mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
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
This commit is contained in:

committed by
GitHub

parent
edd5a69c4c
commit
8a9ea57f01
@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user