Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bd673b

Browse files
authored
Update 0071-simplify-path.js
Removed unnecessary nested if statment
1 parentffc213f commit7bd673b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

‎javascript/0071-simplify-path.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ var simplifyPath = function(path) {
1212
path=`/${path}/`;
1313
for(leti=0;i<path.length;i++){
1414

15-
console.log(myStack);
1615
if(path[i]==='/'){
1716
if(currunt=='..'){
18-
if(myStack.length){
19-
myStack.pop();
20-
}
17+
myStack.pop();
2118
}elseif(currunt!==''&&currunt!=='.'){
2219
myStack.push(currunt);
2320
}
2421
currunt='';
2522
}else{
2623
currunt+=path[i];
2724
}
25+
2826
}
2927

3028
myStack=myStack.join('/');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp