Return filtered array in javascript -


i though going straightforward. have dataset containing (foreach country) name, imfcode, lat,lon. want pass code function filter dataset returning info correspond code passed it. if pass 512 should information relating afganistan. here function, mind telling me i'm doing wring

function loadtrade(imfcode) {   console.log ("country code= ",imfcode)   var sourcecountry=dataset.filter function(el){     return el.imfcode===imfcode   }   console.log ("source country= ",sourcecountry) } 

i keep getting unexpected token , can't see it. many thanks

you missed parenthesis after dataset.filter

change :

function loadtrade(imfcode) {   console.log ("country code= ",imfcode)   var sourcecountry=dataset.filter(function(el){     return el.imfcode===imfcode;   });   console.log ("source country= ",sourcecountry); } 

Comments

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -