【JS学习笔记】内置对象

来源:互联网 发布:淘宝xboxone手柄会假吗 编辑:程序博客网 时间:2024/04/30 04:47
晓石头的博客
邮箱:178673693@qq.com

转载请注明出处,原文链接:http://blog.csdn.net/qiulanzhu/article/details/50663564


//Global对象//URI编码var name = "//qiu 邱"var encodeName = encodeURI(name);var encodecompName = encodeURI(name);document.write(encodeURI(name) +'<br>');document.write(encodeURIComponent(name) +'<br>');document.write(decodeURI(encodeName));document.write(decodeURIComponent(encodeName));//eval()方法//担当一个字符串解析器的作用(常配合数据库使用)eval('var box = 100');document.write(box);//Math对象Math.E;Math.LN10;Math.LN2;Math.LOG2E;Math.LOG10E;Math.PI;Math.SQRT1_2;Math.SQRT2;Math.min(2,3);//最小值Math.max(2,3);//最大值Math.ceil(25.1);//26:向上舍入Math.floor(25.9);//25:向下舍入Math.round(25.5);//26:四舍五入//random():产生随机数//参数lower 到 upper的随机数function selectForm(lower, upper){var number = upper - lower + 1;return Math.floor(Math.random()*number + lower); }


0 0
原创粉丝点击