Skip to content

Instantly share code, notes, and snippets.

@write2lloyd
Created February 13, 2020 07:10
Show Gist options
  • Save write2lloyd/8e16696eb2145bdcbd8150899bba418b to your computer and use it in GitHub Desktop.
Save write2lloyd/8e16696eb2145bdcbd8150899bba418b to your computer and use it in GitHub Desktop.
const data = [
{
id: 1,
truckName: 'van',
truckType: 'truck',
length: 220,
width: 140,
height: 150,
truckWeight: 1000,
iconName: 'van.png',
iconLocation: null,
units: 1,
name: 'van',
maxSpeed: 60,
palletExchange: false,
},
{
id: 2,
truckName: '1-T Open Pick up',
truckType: 'truck',
length: 220,
width: 140,
height: 150,
truckWeight: 1000,
iconName: 'openpickup.png',
iconLocation: null,
units: 1,
name: 'open_pick_up',
maxSpeed: null,
palletExchange: false,
},
{
id: 3,
truckName: '1-T Closed Pick up',
truckType: 'truck',
length: 220,
width: 140,
height: 150,
truckWeight: 1000,
iconName: null,
iconLocation: null,
units: 1,
name: ' ',
maxSpeed: null,
palletExchange: false,
},
{
id: 4,
truckName: '1-T Open Bakkie',
truckType: 'truck',
length: 220,
width: 140,
height: 150,
truckWeight: 1000,
iconName: null,
iconLocation: null,
units: 1,
name: ' ',
maxSpeed: null,
palletExchange: false,
},
];
const filteredTruck = data.filter(truck => truck.truckName === 'van');
console.log(filteredTruck);
console.log(`The length is ${filteredTruck[0].length}`);
console.log(`The width is ${filteredTruck[0].width}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment