foreach return new array javascript