JAVASCRIPT ARRAY




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        const staffdetail = [
            {name:"Gourab Das", age:20, salary: 80000, currency: "INR"},
            {name:"Abhisek ck", age:20, salary: 60000, currency: "INR"},
            {name:"Rahul k", age:20, salary: 90000, currency: "INR"},
            {name:"Jahir", age:20, salary: 100000, currency: "INR"},
            {name:"Anamitra", age:20, salary: 20000, currency: "INR"},
        ]
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //to see all
        staffdetail.forEach((staffdetail)=>{
            let sentence = `I am ${staffdetail.name} a staff of TCS and my salary is ${staffdetail.salary}`;
            document.write("<br>"+sentence);
        });
        document.write("<br>")
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////        
        //to see selected
        staffdetail.forEach(({name})=>{
            let sentence = `I am ${name} a staff of TCS `;
            document.write("<br>"+sentence);
        });
        document.write("<br>");
        staffdetail.forEach(({name,salary})=>{
            if(salary>=80000){
                document.write("<br>"+name);
            }
        });
        document.write("<br>");
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // missing element
        const studentscores =[80, 70, , 90];
        for(i=0;i<studentscores.length;i++){
            document.write("<br>"+studentscores[i]);
        }
        // neglecting the missing element
        document.write("<br>");
        studentscores.forEach((studentscores)=>{
            document.write("<br>"+studentscores);
        });
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    </script>
</head>
<body>
   
</body>
</html>

Comments

Popular posts from this blog

Notes on Compiler and Interpreter in C Programming

GATE exam guide 2024