1 回答

TA貢獻1852條經(jīng)驗 獲得超7個贊
function convert(otherStr) {
console.log(otherStr);//hi
otherStr += otherStr.toUpperCase();
console.log(otherStr);//hiHI
}
function funny(str) {
convert(str);
console.log(str);//hi
}
funny('hi');
不知道這樣是不是能看明白一點
另外如果想第三個想輸出hiHI可以吧代碼改成如下
function convert(otherStr) {
console.log(otherStr);//hi
otherStr += otherStr.toUpperCase();
console.log(otherStr);//hiHI
return otherStr
}
function funny(str) {
//用一個變量來接收convert返回的值,當然也可以不接收直接打印出來
var res = convert(str);
console.log(res);//hiHI
}
funny('hi');
添加回答
舉報