0

I am working on store procedures in snowflake using javascript language.

There I encounter a string having all column names as per my requirement. But the problem is that this string contains a duplicate of these column names like 5-10 times. Now I want to remove these duplicate column names from the string. Or say I want the string to be unique with all column names one time.

My string

var result = "name,id,product,date,name,id,product,date,name,id,product,date,name,id,product,date,name,id,product,date"

Required output string

var result = "name,id,product,date"

How can I achieve this in Javascript?

Note:- I have never worked on javascript before

Mukul Kumar
  • 167
  • 1
  • 9
  • 1
    In regards to the duplicate, you can get an array from your string via `result.split(",")`. For example... `[...new Set(result.split(","))].join(",")` – Phil Jan 05 '22 at 05:12

0 Answers0