vovang,
function searchProperty(array, property, value) {
for (var i = 0; i < array.length; i++) {
var item = array[i];
if (property in item && item[property] == value) {
return i;
}
}
return -1;
}
var park = [{busn:111, name:222, marsh:123}, {busn:222, name:777, marsh:333}];
var marshrut = [];
var index = searchProperty(park, "name", "777");
alert(index);
var obj;
if (index !== -1) {
obj = park.splice(index, 1)[0];
}
if (obj) {
marshrut.push(obj);
}
alert(JSON.stringify(park));
alert(JSON.stringify(marshrut));