Diving In

var data = [132,71,337,93,78,43,20,16,30,8,17,21];

var dataG50 = data.filter(function(i){
    return i > 50;
})

console.log(dataG50);

var donuts = [
    {key: "Glazed",        value: 132},
    {key: "Jelly",        value: 71},
    {key: "Holes",        value: 337},
    {key: "Sprinkles",    value: 93},
    {key: "Crumb",        value: 78},
    {key: "Chocolate",    value: 43},
    {key: "Coconut",     value: 20},
    {key: "Cream",        value: 16},
    {key: "Cruller",     value: 30},
    {key: "Éclair",     value: 8},
    {key: "Fritter",     value: 17},
    {key: "Bearclaw",     value: 21}
];

var dataG50 = donuts.filter(function(i){
    return i.value > 50
})

dataG50.forEach(function(i){
    console.log(i.key);
})

console.log(dataG50);

Special D3 Functions: Min, Max, and Extent

Last updated

Was this helpful?