一.不定项选择
- 1.实现页面元素的隐藏有哪些方式?
display: none; //此时元素实际上就从页面中移走,它下面的所在的元素会自动跟上填充
visibility: hidden; //元素虽然被隐藏了,但它仍然占据它原来所在的位置 - 2.position属性的值及其代表的含义
position: static; //默认值,无定位,元素出现在正常的流中
position: fixed; //生成绝对定位元素,相对于浏览器窗口进行定位
position: absolute; //生成绝对定位的元素,相对于 static 定位以外的第一个父元素进行定位
position: relative; //生成相对定位的元素,相对于其正常位置进行定位
二.读程序,写运行结果
- 1.读程序,写结果
1234567var foo = ‘123’;function print() {var foo = ‘456’;this.foo = ‘789’;console.log(foo);}print();
结果是:456 undefined
- 2.读程序,写结果
1234567function print() {console.log(foo);var foo = 2;console.log(foo);console.log(hello);}print();
结果是:undefined 2 报错
- 3.读程序,写结果
12345678function print() {var test;test();function test() {console.log(1);}}print();
结果是:1 undefined
- 4.读程序,写结果
123456function print() {var x = 1;if(x == ‘1’) console.log(‘One!’);if(x === ‘1’) console.log(‘Two!’);}print();
结果是:One! undefined
- 5.读程序,写结果
1234567891011121314151617function print() {var marty = {name: “marty”,printName:function() {console.log(this.name);}}var test1 = {name: “test1”};var test2 = {name: “test2”};var test3 = {name: “test3”};test3.printName = marty.printName;var printName2 = marty.printName.bind({name: 123});marty.printName.call(test1);marty.printName.apply(test2);marty.printName();printName2();test3.printName();}print();
结果是:test1 test2 marty 123 test3 undefined