• 2022-06-12
    以下哪段代码能正确创建函数show()
    A: var showFun = new function{"text","alert(text)"};
    B: function show(text){alert(text);}
    C: var showFun = function show(text){alert(text);}
    D: var showFun = function(text){alert(text);}
  • B,C

    举一反三

    内容

    • 0

      下列代码的输出结果是__________。<script type="text/javascript">function msg(){ var p=document.createElement("p"); var Text=document.createTextNode("Hello!"); p.appendChild(Text); document.body.appendChild(p);}msg();</script>

    • 1

      以下代码片段的输出结果为( ). &#91;script type="text/javascript"&#93; var foo =1; function Test(){ alert(foo); var foo=2; alert(foo); } Test(); </script A: 1,2 B: 2,1 C: 1,undefined D: undefined,2

    • 2

      下列能弹出“标题1”的jQuery代码是()。标题1 A: alert(S(" #top’).text () B: alert(s(&amp;apos; . top&amp;apos;). text ()) C: alert(S("[name=&amp;apos; headerl’]”). text () D: alert(S(&amp;apos; [name=header1]’).text ();

    • 3

      以下代码片段的输出结果为( ). &#91;script type="text/javascript"&#93; var foo =1; function Test(){ alert(foo); var foo=2; alert(foo); } test(); </script A: 1,2 B: 2,1 C: undefined,2 D: 没有任何结果

    • 4

      下列哪些语句可以定义名为fun的函数 A: function fun(a){alert(a);} B: var fun=function(a){alert(a);} C: var fun=Function("function fun(a){alert(a);} D: fun(a)