内置对象

Url编码方法

encodeURI //编码空格 其它字符不动

encodeURIComponent() //完全编码

var url = "http://haoqiao.me/2016/01/21/qia#ndua nzhilu.html";
console.log(encodeURI(url));
//http://haoqiao.me/2016/01/21/qia#ndua%20nzhilu.html

console.log(encodeURIComponent(url));//http%3A%2F%2Fhaoqiao.me%2F2016%2F01%2F21%2Fqia%23ndua%20nzhilu.html

eval()

它也被戏称为恶魔方法。然而当你用对它的时候它会带来想象不到的功能。友情提升(代码插件)

它像一个完整的js解释器。

eval("alert('123')"); = alert('123')

在eval()中创建的任何函数或变量都不被提升。

Math()

主要会用到

Math.ceil//向上舍入

Math.floor//向下舍入

Math.round//标准舍入

Math.random()//随机返回大于0小于1的数值