clone:legacy
This commit is contained in:
18
depth.js
Normal file
18
depth.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const depth = (n) => {
|
||||
if (n > 1) {
|
||||
return {
|
||||
children: {
|
||||
include: depth(n - 1),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
children: true,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
console.log(JSON.stringify(depth(1000)));
|
||||
//console.log(JSON.stringify(depth(2)))
|
||||
//console.log(JSON.stringify(depth(3)))
|
||||
//console.log(JSON.stringify(depth(4)))
|
||||
Reference in New Issue
Block a user