第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

一個js面試題

一個js面試題

慕斯王 2018-11-13 12:15:50
function convert(s) {    console.log(s);//hi    s +=s.toUpperCase();    console.log(s);//hiHI}function funny(s) {    convert(s);    console.log(s);//hi}funny('hi');//求問為什么第三個是hi嗎?為什么不是hiHI
查看完整描述

1 回答

?
慕姐4208626

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');


查看完整回答
反對 回復 2018-12-09
  • 1 回答
  • 0 關注
  • 484 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號