肯定是大写的,所以我很困惑为什么它会评估为假
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 :(得分:1)
你指的是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");

答案 1 :(得分:0)
这次你忘了关闭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");
答案 2 :(得分:0)
天啊,你应该添加括号:
function myReplace(str, before, after) {
console.log(before[0] === before[0].toUpperCase());
}
myReplace("A quick brown fox jumped over the lazy dog", "Jumped", "leaped");