[0]は間違いなく大文字される前に、それはあなたが関数のtoUpperCaseを参照して偽チェック、解決策が偽の評価
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase();
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
[0]は間違いなく大文字される前に、それはあなたが関数のtoUpperCaseを参照して偽チェック、解決策が偽の評価
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase();
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
に評価している理由、私は混乱しています。あなたが値
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase());
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
あなたがconsole.log
を閉じるのを忘れて、この時間を得るためにそれを呼び出す必要があり、それは次のようになります。
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase());
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
地獄、あなたは括弧を追加する必要があります:
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase());
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");
@ marvel308の答えをコピーしてください。 – Taurus
[単語の最初の文字が大文字であるかどうか](https://stackoverflow.com/questions/8334606/check-if-first-letter-of-word-is-a-capitalletter)の可能な複製 – wp78de