我正在阅读有关建筑反模式的这篇文章,它讨论horizontal and vertical design elements了混合形成一个不稳定的架构.
我无法谷歌这些术语的定义.
这是一个解释我的问题的片段:
+function(str) {
return str.replace(/^[a-z]|\s[a-z]/g,
Function.call.bind(String.prototype.toUpperCase));
}('foo bar baz.'); //Returns Foo Bar Baz.
Run Code Online (Sandbox Code Playgroud)
Function.call有效,但String.toUpperCase没有.我不得不写String.prototype.toUpperCase.