Created
February 9, 2017 05:32
-
-
Save anonymous/9c78ddea80b4ac6ab2cae0b3569bdd42 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/tesoqay
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
<!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> |
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
"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); | |
}()); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment