You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
I hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
I hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
I hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in a single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
HopeI hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in a single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
Hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
I hope that helps!
You can use reduce() and Set combination for example. Read from the docs:
The
Setobject lets you store unique values of any type, whether primitive values or object references.
The
reduce()method executes a reducer function (that you provide) on each element of the array, resulting in a single output value.
Please see a possible working solution.
const array = ['business>management', 'News>Entertainment News', 'business>Entrepreneurship'];
const result = array.reduce((a,c) => {
c.split('>').forEach(e => a.add(e));
return a;
}, new Set());
const unique = Array.from(result);
console.log(unique);
Hope that helps!