Turn String into Alphabet
HTML
<p>
Using <b>'The quick brown fox jumps over the lazy dog'</b> string.<br>
Write a loop that removes all white space.<br>
Then sorts the characters alphabetically.<br>
The output string is just the alphabet.
</p>
JavaScript
var brownFox = function (stringLength) {
var str = ''; // Create an empty string
for(var i = 0; i < stringLength.length; i++) { // Loop through the string
if(str.indexOf(stringLength[i]) == -1) { // Find the first index of the 'string' length, if it's less then 1
str += stringLength[i]; // remove the duplicate char
}
}
return str.split('').sort().join("', '").trim(); // Split returns a new array, need to sort the array alphabetical, then trim the edges
}
alert(brownFox('the quick brown fox jumps over the lazy dog'));