function Ha8(arr, id) {
let result = [];
for(let i = 0; i < arr.length; i++) {
if(Array.isArray(arr[i].children)) {
// if it is a array, it going to be run recursive
result.push(arr[i].children)
const col = Ha8(result[i], id);
if(col === id) {
// find it in array in array
return result
// then return the id object,
} else {
continue; // still can't find.. go ahead!
}
} else if (arr[i]['id']===id) {
return arr[i] // will return valid id object
}
return null // if its none , return null, or parameter id is undefined.
}
}
I m write Intended direction. but its not work..
how can i fix ? give me some tip please.
let input = [
{
id: 1,
name: 'johnny',
},
{
id: 2,
name: 'ingi',
children: [
{
id: 3,
name: 'johnson',
},
{
id: 5,
name: 'steve',
children: [
{
id: 6,
name: 'lisa',
},
],
},
{
id: 11,
},
],
},
{
id: '13',
},
];
output = Ha8(input, 5);
console.log(output); // --> { id: 5, name: 'steve', children: [{ id: 6, name: 'lisa' }] }
output = Ha8(input, 99);
console.log(output); // --> null
I wanna return like that, but only return ‘null’ ..
need to check children’s id and return children’s object by using recursive.
so i write like that. but i have no idea..
how to return correctly children id’s element?
http://levitraoffer.com vardenafil 10 mg
price of accutane – accutane cost uk cheapest generic accutane
http://wardenafil.com vardenafil hcl 10mg
rx amoxicillin 500mg – avatar de price of amoxicillin without insurance Generic Amoxil
buy vardenafil no prescription uk – buy vardenafil 20mg online best online pharmacy vardenafil
http://kamagramama.com kamagra 100
buy cialis online from india – discount pharmacy online buy generic cialis online uk
http://goldkamagra.com ts mychelle kamagra
where can i buy lyrica – generic lyrica cost canadian pharmacy king
http://prescriptionhim.com/ viagra without prescription
Generic Amoxil – amoxicillin 500 mg for sale amoxicillin without a doctorвЂs prescription
http://prescriptionhim.com/ viagra without a doctor prescription
http://cialis20walmart.com cialis cheap online
buy oral ivermectin – stromectol 3 mg dosage price of ivermectin
prednisone 2 mg – no prescription prednisone prednisone 16 mg
https://stromectolhumans.com/ dr pierre kory ivermectin
http://iwermectin.com/ ivermectin
lasix buy online – furosemide 20 mg tablet cost 40 mg lasix
clomiphene for men – buy clomid 50mg clomid online 25mg
can you buy viagra over the counter in south africa – pfizer viagra canadian viagra cost
http://ivermectineffects.com/ ivermectin for sale near me
cialis online pharmacy – buy cialis using paypal where can i buy cialis in australia with paypal
ivermectin 1 – ivermectin 3mg tablet ivermectin 3mg tablets
arthritis finger splint how to take blood pressure with cuff
ivermectin for humans https://ivermectinhome.com
online casinos real money – hollywood casino online online casino real money us
http://ivermectinus.com/ stromectol 3mg
cheap erectile dysfunction pills online – free ed pills ed pills that really work
how to use mobi blood pressure monitor why did hillary clinton create the health care reform
stromectol https://ivermectinhome.com
http://zithrozpack.com/ zpack
prednisone purchase – prednisone 40mg without prescription prednisone 50 mg cost
when is the new healthcare bill by trump wi r sodium aluminum phosphate health risks
ivermectin tablets https://ivermectinhome.com
sildenafil capsules in india – otc viagra 2018 name brand viagra online
cheap viagra online canadian pharmacy – advcialisp.com buy tadalafil in india
https://albuterolotc.com/ albuterol inhaler dosage
ivermectin 0.5% brand name – buy stromectol for humans stromectol tab
how to approved for health insurance subsidy? can win take it away howard superman arthritis take it away
ivermectin for humans for sale https://ivermectinhome.com
over the counter ed pills at walgreens – ed injections natural pills for erectile dysfunction
ventolin price – buy albuterol online ventolin inhalers
how to connect hearing aids to lg tv is heart disease an inevitable part of growing older? why or why not?
is ivermectin a prescription drug https://ivermectinhome.com
cytotec pill canada – where can i get cytotec pills over the counter how to get cytotec in canada
doxycycline prescription coupon – doxycycline order online can i buy 40mg doxycycline online
neurontin sale – prescription drug neurontin levothyroxine 112 mcg
mens health more sex in 2 seconds http://fildenahim.com fildena 100 mg amazon
how to order sildenafil from canada – pharmacy price comparison viagra
what is an annual health screening benefit http://withoutbro.com viagra 120 pills
canadian cialis 20mg – medical pharmacy west cialis 50mg price
what is capital planning in the healthcare reform ivermectin http://iveramectin.com stromectol ivermectin
discount vardenafil online – buy cheap vardenafil uk vardenafil commercial
stromectol medication – stromectol cvs
prednisone medication – 40 mg prednisone daily prednisone 50
buy accutane in mexico – accutane medicine in india buy accutane without prescription
where to buy amoxicillin – generic amoxicillin at walmart buy amoxicillin 500 mg mexico
viagra without a doctor’s prescription http://viagrob.com viagra online prescription free
assignment company – where to buy essays eassy writing
usa viagra – stviag.com best viagra pills uk
furosemide cost without insurance furosemide without prescription nek nox
ivermectin uk coronavirus ivermectin tablets walmart http://stromectl.com ivermectin 3 mg for humans
oral ivermectin cost – stromectol uk ivermectin new zealand
prednisone where can i buy – prednisone tablets prednisone australia
kamagra 100 chewable tablet http://kamagramama.com kamagra india pharmacy i wanna return correctly children’s object. how can i? – JavaScript Help
albuterol nebulizer – ventolin price in india ventolin generic price
how much is doxycycline cost – where can you buy doxycycline online prednisolone pack
http://withoutbro.com – herbal viagra reviews
ivermectin 5 mg – stromectol medication stromectol covid
stromectol over the counter https://ivermectin1.com/ ivermectin 6mg
ivermectin iv – ivermectin oral ivermectin generic
http://stromectolo.com – is ivermectin safe for people
cheap generic sildenafil – sildenafil without doctor sildenafil without a doctor prescription
buy clomid ebay nek nox
buy tadalafil 20mg price – buy tadalafil pills buy tadalafil online safely
accutane cost in uk – buy accutane accutane cost online
cheap essay online – buy a custom essay get assignments done online
ivermectin 1 – ivermectin order oral stromectol cost
canada generic sildenafil – Cialis usa tadalafil prescription cost
https://ivrmectin.com – ivermectin tablets for humans
zyrtec side effects and warnings – https://allergyd.com
plaquenil alternatives – prednisone for sale without a prescription no prescription online prednisone