0

So I was trying to solve this issue and someone suggested me to use Set(). So this was question and solution given to me:

var myArr = [1,2,2,3,3,4,5,5];
var myArr1 = [...new Set(myArr)];

console.log(myArr1);

So basically this solves my problem but my question is why did we use 3 dots before using new keyword. Also if I am not using that I am getting [object Set] in my console. So can someone explain to me the concept behind this?

Amila Senadheera
  • 8,033
  • 10
  • 17
  • 34

0 Answers0