介绍sass:
定义变量css嵌套,允许在代码中使用算式,支持if判断以及for循环
link和@import的区别:
1. link属于html标签,而@import是css提供的
2. 页面被加载时,link会同时被加载,而@import被引用的css会等到引用它的CSS文件被加载完再加载
3. import只在IE5以上才能识别,而link是HTML标签,无兼容问题;
4. link方式的样式的权重 高于@import的权重.
求以下的输出内容是?
var fun = function(){ this.name = 'peter'; return { name: 'jack' }; } var p = new fun(); console.log(p.name); // jack var fun = function(){ this.name = 'peter'; return 'jack'; } var p = new fun(); console.log(p.name); // peter var fun = function(){} fun.prototype = { info : { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom'; console.log(a.info.name); // tom console.log(b.info.name); // tom var fun = function(){ this.info = { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom'; console.log(a.info.name); // jack console.log(b.info.name); // tom var fun = function(){} fun.prototype = { name : 'peter', age : 25 } var a = new fun(); var b = new fun(); a.name = 'jack'; b.name = 'tom'; console.log(a.name); // jack console.log(b.name); // tom var fun = function(){ this.info = { name : 'peter', age : 25 } } fun.prototype = { info : { name : 'peter', age : 25 } } var a = new fun(); var b = new fun(); a.info.name = 'jack'; b.info.name = 'tom'; console.log(a.info.name); // jack console.log(b.info.name); // tom