Home > Enterprise >  Print values of JavaScript Object
Print values of JavaScript Object

Time:11-15

I print some results as:

arr.forEach(el => console.log(el));

and I receive results of the form:

{
  x: NamedNode {
    termType: 'NamedNode',
    value: 'http://dbpedia.org/resource/Ajamaru_Lakes_rainbowfish'
  }
}
{
  x: NamedNode {
    termType: 'NamedNode',
    value: 'http://dbpedia.org/resource/Akarotaxis_nudiceps'
  }
}

However, I would like to print only the value of each NamedNode, e.g. 'http://dbpedia.org/resource/Ajamaru_Lakes_rainbowfish'

Could you help me, please?

CodePudding user response:

Try:

arr.forEach(el => console.log(el.x.value));
  • Related