Created
December 8, 2019 21:08
-
-
Save softauthor/4905caceeb0fcf6477a52bb33ba48c9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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