How to get distinct values from an array of objects in JavaScript?

前端 未结 30 2625
执笔经年
执笔经年 2020-11-22 05:29

Assuming I have the following:

var array = 
    [
        {\"name\":\"Joe\", \"age\":17}, 
        {\"name\":\"Bob\", \"age\":17}, 
        {\"name\":\"Carl\         


        
30条回答
  •  [愿得一人]
    2020-11-22 05:58

    I know my code is little length and little time complexity but it's understandable so I tried this way.

    I'm trying to develop prototype based function here and code also change.

    Here,Distinct is my own prototype function.

提交回复
热议问题