How to check if array of objects has same value for same key?

I have an array of object ,wanted to check the key "PhysicalVirtual" has same value in all objects.
if it has same value, should return true else it should return false.

code which I have tried:

var testArray=[{
    "Hostname": "NDCWCAP03",   
    "PhysicalVirtual": "P",
    "Tier1": null,
    "Tier3": null,    
}, {
    "Hostname": "NDCWCAP05",
    "PhysicalVirtual": "P",
    "Tier1": null,
    "Tier3": null,    
}];

gs.info(testArray.find(key => key.PhysicalVirtual === 'P'));

Error: getting syntax error here

Evaluator: com.glide.script.RhinoEcmaError: syntax error
   script : Line(13) column(30)
console.log(testArray.find(key => key.PhysicalVirtual === 'P'));

203 thoughts on “How to check if array of objects has same value for same key?”

  1. Pingback: viagra prices
  2. Pingback: cialis orange pill
  3. Pingback: viagra sample
  4. Pingback: sildenafil online
  5. Pingback: sildenafil 20 mg
  6. Pingback: viagra pills
  7. Pingback: lilly cialis 5mg
  8. Pingback: cheapest viagra
  9. Pingback: viagra 20 mg
  10. Pingback: cialis canada
  11. Pingback: viagra price usa
  12. Pingback: cialis dosis
  13. Pingback: viagra cost
  14. Pingback: women viagra
  15. Pingback: viagra bestellen
  16. Pingback: female viagra pill
  17. Pingback: viagra vs cialis
  18. Pingback: cvs viagra
  19. Pingback: cheap viagra
  20. Pingback: pfizer viagra
  21. Pingback: teva sildenafil
  22. Pingback: sildenafil citrate
  23. Pingback: sildenafil revatio
  24. Pingback: calis

Leave a Comment