Skip to content

Instantly share code, notes, and snippets.

@KantaPaul
Created March 9, 2020 06:43
Show Gist options
  • Save KantaPaul/aef96043cf09d358557bbb5a7ed7f98a to your computer and use it in GitHub Desktop.
Save KantaPaul/aef96043cf09d358557bbb5a7ed7f98a to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/bonuhiv
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
let arr = [
{
post_data: {
tag: 'hello , world'
}
},
{
post_data: {
tag: 'joy , bangla'
}
},
{
post_data: {
tag: 'hello , foo'
}
}
]
let newarr = [];
arr.map((value, index) => {
return newarr.push(value.post_data.tag)
})
let joinvalue = newarr.join(', ');
let replacevalue = joinvalue.replace(/[^a-zA-Z ]/g, "");
let spilitvalue = replacevalue.split(' ')
let removeclone = spilitvalue.filter((value, index, arr) => {
return arr.indexOf(value) === index;
})
let removeemptyspace = removeclone.filter((value) => {
return value !== "";
})
console.log(removeemptyspace)
</script>
<script id="jsbin-source-javascript" type="text/javascript">let arr = [
{
post_data: {
tag: 'hello , world'
}
},
{
post_data: {
tag: 'joy , bangla'
}
},
{
post_data: {
tag: 'hello , foo'
}
}
]
let newarr = [];
arr.map((value, index) => {
return newarr.push(value.post_data.tag)
})
let joinvalue = newarr.join(', ');
let replacevalue = joinvalue.replace(/[^a-zA-Z ]/g, "");
let spilitvalue = replacevalue.split(' ')
let removeclone = spilitvalue.filter((value, index, arr) => {
return arr.indexOf(value) === index;
})
let removeemptyspace = removeclone.filter((value) => {
return value !== "";
})
console.log(removeemptyspace)</script></body>
</html>
let arr = [
{
post_data: {
tag: 'hello , world'
}
},
{
post_data: {
tag: 'joy , bangla'
}
},
{
post_data: {
tag: 'hello , foo'
}
}
]
let newarr = [];
arr.map((value, index) => {
return newarr.push(value.post_data.tag)
})
let joinvalue = newarr.join(', ');
let replacevalue = joinvalue.replace(/[^a-zA-Z ]/g, "");
let spilitvalue = replacevalue.split(' ')
let removeclone = spilitvalue.filter((value, index, arr) => {
return arr.indexOf(value) === index;
})
let removeemptyspace = removeclone.filter((value) => {
return value !== "";
})
console.log(removeemptyspace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment