INNER CODE UNIT · JavaScript

atleastOneUnhealthyKidney

irohandev/WebDev-DevOps-Cohort-3.0 · Week-04 NodeJs, Bun, Http Servers/Offline-Videos/01_Express/Array-Kidney-Game/index.js:86

    let atleastOneUnhealthyKidney = false;                  //assume kr liye ki atleast ek bhi kidney unhealthy nhi hai isliye false kiye
    for (let i = 0; i<users[0].kidneys.length; i++) {       //phir usko parse kiye loop se aur check kiye ki jo asuume kiye sahi hai ya glat
        if (!users[0].kidneys[i].healthy) {                 //agar healthy false raha toh if statement ke andar jao
            atleastOneUnhealthyKidney = true;               //aur then isko update kro ki ek ki nahi kidneys unhealthy bhi present hai
        }
    }
    return atleastOneUnhealthyKidney                        //return kr do jo bhi unhealthy kidney ko
}
app.listen(3000);


/*
Notes:
- Jab jab refresh kr denge toh data will become like jo hamne shuru mein initiliaze kiya hai woh ban jyega waise hi
- If kisi ko healthy ya unhealthy kidney post krna hai toh postman mein jayenge aur post krke local host krenge niche data choose krenge json aur body yeh likhnge :
        {
            isHealthy: true   //yeh good kidney ke count ko bdhane ke liye 
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…