var rythuBazaar=[ { farmerName:'kondaih', business:'beetroot' }, { farmerName:'veeraya', business:'chillies' }, { farmerName:'shivayaa', business:'beetroot' }, { farmerName:'veeren', business:'chillies' }, { farmerName:'raaju', business:'beetroot' } ]; console.log('Persons who are engaged in beetroot business= '); for(var i=0;i<rythuBazaar.length;i++) { if(rythuBazaar[i].business==='beetroot') { console.log(rythuBazaar[i].farmerName); } }; console.log('Farmers engaged in chillies business='); for(var i=0;i<rythuBazaar.length;i++) { if(rythuBazaar [i].business==='chillies') { console.log (rythuBazaar [i].farmerName); } } rythuBazaar.forEach(function(rythuBazaar) { console.log(rythuBazaar); }); rythuBazaar.forEach(function(rythuBazaar) { if(rythuBazaar.business==='beetroot') { console.log(rythuBazaar.farmerName); } });
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more