We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ffc213f commit 7bd673bCopy full SHA for 7bd673b
javascript/0071-simplify-path.js
@@ -12,19 +12,17 @@ var simplifyPath = function(path) {
12
path = `/${path}/`;
13
for(let i = 0; i < path.length; i++) {
14
15
- console.log(myStack);
16
if(path[i] === '/') {
17
if(currunt == '..') {
18
- if(myStack.length) {
19
- myStack.pop();
20
- }
+ myStack.pop();
21
} else if(currunt !== '' && currunt !== '.') {
22
myStack.push(currunt);
23
}
24
currunt = '';
25
} else {
26
currunt += path[i];
27
+
28
29
30
myStack = myStack.join('/');
0 commit comments