import React from 'react'
export default function App() {
const jiechen=(n)=>{
if (n===1) {
return 1
}
return n*jiechen(n-1)
}
const result= jiechen(10)
return (
<div>
{result}
</div>
)
}
import React from 'react'
export default function App() {
const data=[{name:"家电",id:1,goods:[{name:"洗衣机",id:11,}]},
{name:"空调",id:2}
]
const kk=(data,id)=>{
var o={}
data.forEach((item)=>{
if (item.id===id) {
o=item
}else if(item.goods){
o= kk(item.goods,id)
}
})
return o
}
console.log(kk(data,11));
console.log(kk(data,1));
return (
<div>
</div>
)
}