Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

array of object

//Rekey is receiving info about applicants for his startup company (as array of objects), containing first name,  last name, age and technology they know.  Rekey only cares about the full name and the technology if the applicant has more than one year of Ex
const cvFormatter = (arr) => {
    
        let arr2 = [];
        for (let i = 0; i < arr.length; i++) {
                 const e = arr[i];
            if (e.lastName === null && e.yearsOfExperience > 1) {
                     arr2.push({ fullName: `${e.firstName}`, tech: `${e.tech}` });
    
            } else if (e.yearsOfExperience > 1) {
                         arr2.push({ fullName: `${e.firstName} ${e.lastName}`, tech: `${e.tech}` });
            } else continue; 
        } return arr2;
    
};


//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #array #object
ADD COMMENT
Topic
Name
9+1 =