加入收藏 | 设为首页 | 会员中心 | 我要投稿 好传媒门户网 (https://www.haochuanmei.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营 > 正文

秋招笔试碰到的疑难题目1

发布时间:2020-12-25 09:14:05 所属栏目:运营 来源:网络整理
导读:30、关于return语句 function foo(a,b){ return a + b;} var t=foo(3,4 );console.log(t) // undefined ? 29、关于自执行匿名函数 for ( var i=0;i3;i++ ){ setTimeout(( (a){ console.log(a); })(i), 0 );} //0,1,2 ? 28、来自网易笔试的一道题目:下面表明

  解析:substring() 方法用于提取字符串中介于两个指定下标之间的字符。返回是一个新的字符串,该字符串值包含?stringObject?的一个子字符串,其内容是从?start?处到?stop-1 处的所有字符,其长度为?stop?减start。当第二个为负数的时候,会变成0,并比较两个参数的大小,将小的放在前面。

substr(s1,s2)接受两个参数,第一个是起始位置,第二个是参数数表示截取的长度。当第二个为负数的时候,会变成0,也就是截取0个数字,返回空。

?

?

10、考察对new的理解,还有就是this指向哪里

     var name="u";
p(name){ this.name=name; }
p1=p("t"); p2=new p("r");
console.log(p1);undefined console.log(p2);p的一个实例对象 console.log(name);t console.log(p2.name);r console.log(p1.name); cannot read property

?

9、考察对css位置的理解,x是否都在y的左边,还有两个选项忘了

  <p style="float:left">x<p>
    <p style="float:right">y</p>
    <br>
    <br>
    <p style="float:left">x</p>
    <p style="width:100%;background:red;">y</p>

秋招笔试碰到的疑难题目1

?

8、对一些不常用css的考察

  • :nth-last-of-type()?
  • :last-of-type?

  • :nth-of-type

这几个都是存在的。。。。。貌似我选错了

?

7、用和不用use strict

解析:严格模式下,对象不能有重名的属性。正常模式下,如果对象有多个重名属性,最后赋值的那个属性会覆盖前面的值。严格模式下,这属于语法错误。

      严格模式详解参考:http://www.cnblogs.com/jiqing9006/p/5091491.html

    我尝试结果是:

    IE:

    使用严格模式:(报错)

?

      

秋招笔试碰到的疑难题目1

?

    不使用严格模式:(不报错)

?

      

秋招笔试碰到的疑难题目1

?

    Chrome:

    用不用严格模式都不报错:

?

      

秋招笔试碰到的疑难题目1

?

      

秋招笔试碰到的疑难题目1

?

    Firefox:

    用不用严格模式都不报错:

?

      

秋招笔试碰到的疑难题目1

      

秋招笔试碰到的疑难题目1

?

?

?

?

6、考察math round,ceil,floor的区别

  round()方法第二题解析过,是取与 x 最接近的整数,不一定大于等于参数

  floor()?方法可对一个数进行下舍入。该方法执行的是向下取整计算,它返回的是小于或等于函数参数,并且与之最接近的整数。

  ceil() 方法可对一个数进行上舍入。该方法执行的是向上取整计算,它返回的是大于或等于函数参数,并且与之最接近的整数。

?

5、页面有一个按钮button id为 button1,通过原生的js如何禁用?

<input type="button" id="button1" value="1">
    <input type="button" id="button2" value="2">
    <input type="button" id="button3" value="3">
    <input type="button" id="button4" value="4">
    <input type="button" id="button5" value="5">
    <input type="button" id="button6" value="6">
    <script>
    var t1=document.getElementById("button1"var t2=document.getElementById("button2"var t3=document.getElementById("button3"var t4=document.getElementById("button4"var t5=document.getElementById("button5"var t6=document.getElementById("button6");
    t1.setAttribute("disabled"," true");yes
    t2.setAttribute("readonly",true);no
    t3.disabled=true;yes
    t4.readonly=no
    t5.setAttribute("disabled",1)">yes
    t6.setAttribute("readonly","true");//no

(编辑:好传媒门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读