INNER CODE UNIT · JavaScript

newKidneys

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

        const newKidneys = [];                      //new kidney ke array ko initialize kiye hai
        for (let i = 0; i<users[0].kidneys.length; i++) {       //yeh loop se sare ko parse kr rha 
            if (users[0].kidneys[i].healthy) {              
                newKidneys.push({
                    healthy: true                   //yeh sare healthy yani ki good kidneys ko new kidney wle array mein push kr dega 
                })
            }
        }
        users[0].kidneys = newKidneys;              //yeh uspe pass ho rha hai 
        res.json({msg: "done"})   
    } else {                                        //if sare hi agar good kidney hua toh dlete ka mtlab nhi bana isliye yeh status return krega yeh aur sath mein niche ka msg ki no bad kidneys 
        res.status(411).json({
            msg: "You have no bad kidneys"
        });
    }
})
//What should happen if they try to delete when there are no kidneys? iske ans k liye yeh function define kiye -
function isThereAtleastOneUnhealthyKidney() {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…