I have a problem with an array:
When I try to edit "brands.count", in countBrends() function, I get the error "count is read only".
Do you have any suggestions?
code:
allCars:Car[] 
brands:BrandCB[]
types:TypeCB[]
arr:any[] = [{count:1},{count:2},{count:3}]
constructor( private store:Store<StoreState>){ }
ngOnInit(): void {
    this.store.dispatch(carsActions.getAllCars())
    this.store.dispatch(brandsActions.getBrands())
    this.store.pipe(select(carsSelectors.getAllCars)).subscribe(
        cars => {
            this.allCars = [...cars]
        }
    )
    this.store.pipe(select(brandsSelectors.getBrands)).subscribe(
        brands => {
            this.brands = this.countBrands([...brands])
        }
    )
}
// it counts how many cars there are of the same brand 
// and enters the number in the "count" property of brands
countBrands(brands):BrandCB[]{
    return brands.forEach( brand =>{
        let count = 0
        this.allCars.forEach( car => {
            car.brand == brand.name ? count++ : null
        })
        brand.count = count
    })
}
 
    