в приведенном ниже коде. Я хочу напечатать значения «years_of_experience», который меньше 34 и место рождения, равное «texas». Но я не получаю, как написать заявление правильноКак проверить свойства объекта, равные некоторому значению?
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"
}];
employees.forEach(function(a) {
console.log(a);
});
for(var i = 0;i <= employees.length;i++)
{
if(employees[i]!= -1)
{
console.log("gotcha");
if(employees.hasOwnProperty === years_of_experience) < 34 || (employees.hasOwnProperty(birth_place) === "teaxs")
{
//here i want to print the values of
// "years_of_experience" which is less than 34 and birthplace which is equal to
// "texas".But i'm not getting how to write the statement for that become m new to
// javascript and even m not sure i've written the conditional statement right,
// please correct it and help me..
}
}
}
[Любой конкретный вопрос?] (Http://stackoverflow.com/faq) – Lion
если (сотрудников [я] [ "years_of_experience"] <34 || (сотрудников [i] ["birth_place"] === "texas") – mplungjan
hey thanx Lion для записи условного оператора, но как я напечатаю значения, которые я получу из условия после получения истины. – user1976940