programming-examples/js/Functions/Write a JavaScript function to extract unique characters from a string..js

16 lines
305 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function unique_char(str1)
{
var str=str1;
var uniql="";
for (var x=0;x < str.length;x++)
{
if(uniql.indexOf(str.charAt(x))==-1)
{
uniql += str[x];
}
}
return uniql;
}
console.log(unique_char("thequickbrownfoxjumpsoverthelazydog"));