摘要:
基本语法 JavaScript的语法和Java语言类似,每个语句以;结束,语句块用{...}。但是,JavaScript并不强制要求在每个语句的结尾加;,浏览器中负责执行JavaScript代码的引擎会自动在每个语句的结尾补上;。 var x = 1; if (2 > 1) { x = 1; y = 阅读全文
摘要:
Date 在JavaScript中,Date对象用来表示日期和时间。 要获取系统当前时间,用: var now = new Date(); now; // Wed Jun 24 2015 19:49:22 GMT+0800 (CST) now.getFullYear(); // 2015, 年份 n 阅读全文
摘要:
Math.random():获取0~1随机数Math.floor() method rounds a number DOWNWARDS to the nearest integer, and returns the result. (小于等于 x,且与 x 最接近的整数。)其实返回值就是该数的整数位 阅读全文