D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
JacobHsu
Full window
Github gist
ES6 toUpperCase JS Bin// source https://jsbin.com/tesoqay
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head> <body> <button id="main_button">click me</buttton> <script id="jsbin-javascript"> "use strict"; { (function () { "use strict"; var capify = function capify(str) { return [str.charAt(0).toUpperCase(), str.substring(1)].join(""); }; var processWords = function processWords(fn, str) { return str.split(" ").map(fn).join(" "); }; var getValue = function getValue() { var something = prompt("Give me something to capitalize"); alert(processWords(capify, something)); }; document.getElementById("main_button").addEventListener("click", getValue); })(); } /* (function() { "use strict"; var capify = function(str) { return [str.charAt(0).toUpperCase(), str.substring(1)].join(""); }; var processWords = function(fn, str) { return str.split(" ").map(fn).join(" "); }; var getValue = function(e) { var something = prompt("Give me something to capitalize"); alert(processWords(capify, something)); }; document.getElementById("main_button").addEventListener("click", getValue); }()); */ </script> <script id="jsbin-source-javascript" type="text/javascript">{ "use strict"; const capify = str => [str.charAt(0).toUpperCase(), str.substring(1)].join(""); const processWords = (fn, str) => str.split(" ").map(fn).join(" "); const getValue = () => { let something = prompt("Give me something to capitalize"); alert(processWords(capify, something)); } document.getElementById("main_button").addEventListener("click", getValue); } /* (function() { "use strict"; var capify = function(str) { return [str.charAt(0).toUpperCase(), str.substring(1)].join(""); }; var processWords = function(fn, str) { return str.split(" ").map(fn).join(" "); }; var getValue = function(e) { var something = prompt("Give me something to capitalize"); alert(processWords(capify, something)); }; document.getElementById("main_button").addEventListener("click", getValue); }()); */</script></body> </html>