*前端对象类型:①基本类型:String,Array,Number,Boolean,null,undefined
②其他:Function,Object,Symbol(ES6引入类型)
*函数声明:function add(){}
函数表达式:add=function(){}
*变量提升 函数:function add(){}
变量:var add;
*对象创建模式:①工厂模式:function person(name,age){
var obj=new Object();
obj.name=name;
obj.age=age;
return obj;
}
②构造函数:function Person(name,age){this.name=name;
this.age=age;
}
③普通函数:function person(name){
return name;}
移动端
(function(win,doc){
var docEl = doc.documentElement || document.body;//获取HTML标签
var container = doc.getElementById(‘container’);//container元素
//判断是移动端设备还是PC,移动 就采用’orientationchange’,横竖屏事件,PC端就采用onresize,窗口改变事件
var resize = ‘orientationchange’ in win ? ‘orientationchange’:‘resize’;
function rem(){
docEl.style.fontSize= 100*(container.clientWidth/750)+‘px’;
}
doc.addEventListener(‘DOMContentLoaded’,rem,false);
//监听’DOMContent事件:DOM加载完成执行,如果DOMContent事件,那么执行rem函数
//alert(resize);
win.addEventListener(resize,rem,false);
//win下监听resize事件,如果resize事件,那么执行rem函数
})(window,document)