Skip to content

Commit aa5079d

Browse files
authored
added prettier to code
1 parent 3c8c693 commit aa5079d

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

find-node.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1+
const findNode = (tree, value) => {
2+
let found = false;
13

2-
const findNode = (tree,value) => {
3-
4-
let found = false ;
5-
6-
if (tree.value === value) {
7-
return true;
8-
}
4+
if (tree.value === value) {
5+
return true;
6+
}
97

10-
for(var index=0;index< tree.children.length;index++) {
11-
const element = tree.children[index];
12-
found = findNode(element,value);
13-
if(found){
14-
break;
15-
}
16-
};
17-
18-
return found;
19-
}
8+
for (var index = 0; index < tree.children.length; index++) {
9+
const element = tree.children[index];
10+
found = findNode(element, value);
11+
if (found) {
12+
break;
13+
}
14+
}
2015

16+
return found;
17+
};
2118

2219
/* example tree
2320

0 commit comments

Comments
 (0)