Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

map loop for object

 const shots = [
            {id: 1, salary:100,name:'Win Win Maw',position:'junior'},
            {id: 2, salary:130,name:'Mg Mg',position:'junior'},
            {id: 3, salary:200,name:'KO KO',position:'senior'},
            {id: 4, salary:90,name:'Hla Hla',position:'intern'},
            {id: 5,  salary:250,name:'Ni Lar',position:'senior'},
            ];


            //increment Salary by percentage
                let salaries = shots.map((e)=>{
                    return e.salary
                })

                let percent = 5 ;
                salaries.forEach(increaseSalary => {
                    increaseSalary += (increaseSalary * percent) / 100;
                    console.log(increaseSalary);
                }); 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #loop #object
ADD COMMENT
Topic
Name
4+2 =