好玩的三道题:
笔试题:
function foo(){
var i =0;
return function(){
console.log(i++);
}
}
var foo1 = foo();
var foo2 = foo();
foo1();
foo1();
foo2();
//0 1 0
解析:第一次调用foo1()后,下次不再执行var i= 0了,直接调用return里的函数
html布局:
布局题:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
#father{
width: 300px;
border: 1px solid red;
}
#child1{
width: 100px;
height: 100px;
background: red;
float: left;
}
#child2{
width: 100px;
height: 100px;