Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save softauthor/4905caceeb0fcf6477a52bb33ba48c9a to your computer and use it in GitHub Desktop.
Save softauthor/4905caceeb0fcf6477a52bb33ba48c9a to your computer and use it in GitHub Desktop.
(function () {
"use strict";
var removeSpace = function (item) {
return item.trim();
}
var sortFruits = function (fn, str) {
return str.split(",").map(fn).sort();
};
document.getElementById("main_button").addEventListener("click", function (e) {
var fruitsString = document.getElementById("input_value").value;
console.log(sortFruits(removeSpace, fruitsString));
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment