# A collection of Web front-end School recruit Pen Questions

Source: Internet
Author: User

Write a sum function sum to achieve the following effect
`// should equalsum (1, 2, 3, 4, 5); // should equal 0 null,-5); // should equal false true, 1, ' A ', 1, ' B ', 1, ' C ', 1, ' D ', 1,  ' E ', 1, ' F ', 1, ' G ', 1); // should equal 0.3, not 0.30000000000000004sum (0.1, 0.2);`
```function sum () {    var nresult = 0;      for (var i = 0, L = arguments.length; i < L; i++) {        + = Window.parsefloat (Arguments[i]) | | 0;
}    return nresult.tofixed (3) * 1000/1000;}```

Please write a table as well as the corresponding CSS, make the table odd behavior white background, even behavior gray background, mouse moved up to yellow background.

`<Tableclass= "Table">  <TR><TD>First line</TD></TR>  <TR><TD>Second line</TD></TR>  <TR><TD>Third line</TD></TR>  <TR><TD>Line Four</TD></TR></Table> <style>. Table Tr:nth-child (2n-1){Background-color: White;  }. Table Tr:nth-child (2n){Background-color:Grey;  }. Table Tr:hover{Background-color:Yellow;  }</style>`

Write a traverse function that outputs all nodes with a page width and height greater than 50 pixels.

`functionTraverse (onode) {varAresult = []; Onode= Onode | |document.body; if(onode.style) {varnwidth = Window.parseint (oNode.style.width, 10) | | 0; varnheight = Window.parseint (oNode.style.height, 10) | | 0; if(Nwidth > && nheight > 50) {Aresult.push (onode); }    }    varAchildnodes =Onode.childnodes; if(Achildnodes.length > 0) {         for(vari = 0, L = achildnodes.length; I < L; i++) {            varOtmp =Achildnodes[i]; Aresult=Aresult.concat (Traverse (otmp)); }    }    returnAresult;}`

A collection of Web front-end School recruit Pen Questions

Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.