0

Take this demo as an example

series : [{
    name: 'UTC',
    data: $.map(['IE', 'IS', 'GB', 'PT'], function (code) {
        return { code: code };
    })
}, {
    name: 'UTC + 1',
    data: $.map(['NO', 'SE', 'DK', 'DE', 'NL', 'BE', 'LU', 'ES', 'FR', 'PL', 'CZ', 'AT', 'CH', 'LI', 'SK', 'HU',
            'SI', 'IT', 'SM', 'HR', 'BA', 'YF', 'ME', 'AL', 'MK'], function (code) {
        return { code: code };
    })
}, {
    name: 'UTC + 2',
    data: $.map(['FI', 'EE', 'LV', 'LT', 'BY', 'UA', 'MD', 'RO', 'BG', 'GR', 'TR', 'CY'], function (code) {
        return { code: code };
    })
}, {
    name: 'UTC + 3',
    data: $.map(['RU'], function (code) {
        return { code: code };
    })
}]

Let's say, as an arbitrary example, I wanted to create an entry with name: 'starts with A' and I wanted the data object to contain all objects in $.map where code.indexOf('A') == 0 (basically checking if the first character in code is an 'A'.

With pseudocode, this is how I would approach it, I'm just not sure how to execute it.

{
name: 'starts with A',
data: $.map(/* Select all entries somehow */, function (code) {
        if(code.indexOf('A') == 0)
            return { code: code };
    })
}
jlewkovich
  • 2,725
  • 2
  • 35
  • 49

0 Answers0