Answer the question
In order to leave comments, you need to log in
JavaScript. How to remove two different elements from an array?
const arr = [
{ "Name": "Alex", "sex":"man","age":50,"workplace":"office"},
{"Name": "Katya", "sex":"woman","age":33,"workplace":"office"},
{"Name": "Igor", "sex":"man","age":22,"workplace":"park"},
{"Name": "Olga", "sex":"woman","age":19,"workplace":"park"},
{"Name": "Maks", "sex":"man","age":40,"workplace":"hotel"}
];
let arr2 = [];
for(let prop in arr){
if(arr[prop].workplace == "office"){
arr2.push(arr[prop]);
}
}
console.log(arr2);
office
, but to also display hotel
, how to do this?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question