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');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…