Skip to content

Commit

Permalink
fix 001_recursion.js fileSize
Browse files Browse the repository at this point in the history
  • Loading branch information
yko-git committed Mar 10, 2024
1 parent b9ccdce commit f69020b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions 004_algorithm/001_recursion.js
Expand Up @@ -103,13 +103,11 @@ function fibonacci(num) {
*/

function fileSize(node, sum = 0) {
let sumNum = 0;

if (node["children"]) {
for (let value of node.children) {
sumNum = sumNum + value.size;
sum = sum + value.size;
}
return sumNum;
return sum;
} else {
return node.size;
}
Expand Down

0 comments on commit f69020b

Please sign in to comment.