html ES6 toUpperCase JS Bin //来源https://jsbin.com/tesoqay
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html ES6 toUpperCase JS Bin //来源https://jsbin.com/tesoqay相关的知识,希望对你有一定的参考价值。
"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);
}());
*/
<!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>
以上是关于html ES6 toUpperCase JS Bin //来源https://jsbin.com/tesoqay的主要内容,如果未能解决你的问题,请参考以下文章
Discord.js 中的前缀问题(包括 .toUpperCase())
es6总结 ——开发环境
ES6 模块化module
js es6 解构赋值
Webpack中无法加载babel ES6解析
“js”怎么转换大小写?