var myarray = [
{
"msf": "3.98",
"ptc": "5.00"
},
{
"msf": "3.98",
"ptc": "1.00"
},
{
"msf": "3.98",
"ptc": "1.00"
}
]
Expect answer is : true
>Solution :
This is a hacky way.
But I can sure there’s a better way.
var myarray = [ { "msf": "3.98", "ptc": "5.00" }, { "msf": "3.98", "ptc": "1.00" }, { "msf": "3.98", "ptc": "1.00" } ]
const seen=[];
const dupe=[];
myarray.forEach(e=>(seen.includes(JSON.stringify(e))?dupe:seen).push(seen.includes(JSON.stringify(e))?e:JSON.stringify(e)))
console.log(dupe);