function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Himanshu GhateHimanshu Ghate 

I have created the allcars(Object inJavascript)={Car1,Car2,Car3} data is available.

Error-->Is coming that the allcars is not a function.but I want to retrive on patricular car from allcars.In this I have created Car1,Car2,and Car3 data,and put It into the AllCars={car1,car2,car3},If I want to use AllCar inside the filter on particular condition ,and I want to retrive the data of particular Car1 or car 2 or car 3 from the all car,but it saying all cars is not a function..How it will work please let me know.
 
Gian Piere VallejosGian Piere Vallejos
You are not allow to use the filter method in Objects from Javascript. That's a common mistake. Filter, Reduce and Map are methods of an Array in Javascript. 

To solve this, you should include your Car1, Car2 and Car3 data into an array, this way: 
let allCarsArr = [car1, car2, car3];
allCarsArr.filter(value => {
  console.log(value.Color);
});
You can get more information here: Array Object | Javascript (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" target="_blank)
 
Himanshu GhateHimanshu Ghate
Thank you so much.