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