Skip to content

Commit 8a9ea57

Browse files
fixed issue with delete operator on stacks (TheAlgorithms#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
1 parent edd5a69 commit 8a9ea57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Data-Structures/Stack/Stack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var Stack = (function () {
3030

3131
this.top--
3232
var result = this.stack[this.top]
33-
delete this.stack[this.top]
33+
this.stack = this.stack.splice(0, this.top)
3434
return result
3535
}
3636

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy