find element by object field vuejs

Solutions on MaxInterview for find element by object field vuejs by the best coders in the world

showing results for - "find element by object field vuejs"
Simone
23 Jan 2019
1var data = {specs:[{Name:"Power",Value:"1"},{
2    Name:"Weight",Value:"2"},{Name:"Height",Value:"3"}]}
3    
4var valObj = data.specs.filter(function(elem){
5    if(elem.Name == "Power") return elem.Value;
6});
7
8if(valObj.length > 0)
9    console.log(valObj[0].Value)