![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javascript
安心@-@
这个作者很懒,什么都没留下…
展开
-
JS数据类型有哪些,区别是什么?
基本数据类型引用数据类型:Object(数组、正则、日期、Math):基本数据类型直接存储在中引用数据类存在中,指针变量存在中,根据指针找到堆内存中的引用对象。原创 2022-09-07 09:30:23 · 490 阅读 · 0 评论 -
JavaScript 猜数字:随机生成一个1-20的整数,用Math.random()方法
<script> function getRandom(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } var random = getRandom(1, 10); while (true) { var num = prompt('您来猜,输入1-20之间的数字'); .原创 2021-10-07 13:36:47 · 3696 阅读 · 0 评论 -
JavaScript 预解析 例子
1. 预解析分为变量预解析(变量提升)和函数预解析(函数提升)2.变量提升:把所有的变量声明提升到当前的作用域最前面不提升赋值操作3. 函数提升:把所有的函数声明提升到当前作用域的最前面不调用函数预解析例f1(); console.log(c); console.log(b); console.log(a); function f1() { var a = b = c = 9; ...原创 2021-09-26 14:37:01 · 53 阅读 · 0 评论 -
函数判断闰年:输入年份 判断此2月份的天数
<script> //用户输入年份,判断当年2月份的天数 function backDay() { var year = prompt('请输入年份'); if (isRunYear(year)) { //调用函数需要加小括号 alert('闰年,2月份有29天'); } else { alert('平年,2月份有28天');.原创 2021-09-25 11:52:39 · 1882 阅读 · 1 评论