JSFiddle - React, Tailwind, and code Playground

by Cwalkdawg

JavaScript

var employees = [{
    name1: 'jacob',
    age2: 23,
    date_of_join: "23 / 03 / 2013",
    years_of_experience: 12,
    birth_place: "virginia"
}, {
    name2: 'sheldon',
    age2: 34,
    date_of_join: "2 / 03 / 2013",
    years_of_experience: 15,
    birth_place: "lisbon"
}, {
    name3: 'johnny',
    age3: 25,
    date_of_join: "29 / 03 / 2013",
    years_of_experience: 13,
    birth_place: "texas"
}];

for (var i = 0; i < employees.length; i++) {

    if (employees[i].hasOwnProperty("years_of_experience") && employees[i].hasOwnProperty("birth_place")) {
        if (employees[i].years_of_experience < 34 || employees[i].birth_place === "texas") {
            console.log("Year of Experience: \n" + employees[i].years_of_experience + "\nBirth Place: " + employees[i].birth_place);
        }
    }
}