Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Filter unique values in an array">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
const sample = ['_conf.scss', '_mixin.scss', '_mixin.scss', '_mixin.scss', 'main.scss'];
console.clear();
// Return true when the indexOf(element) is the current index, otherwise we've seen element already.
const filtered = sample.filter((element, index, array) => array.indexOf(element) === index);
console.log(filtered);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
theprivilegespro
0viewers