摘要:
内部对象 Date var now = new Date(); now.getFullYear(); //年 now.getMonth(); //月 0~11月 now.getDate(); //日 now.getDay(); //星期几 now.getHours(); //时 now.getMin 阅读全文
posted @ 2022-09-14 20:16
GrowthRoad
阅读(17)
评论(0)
推荐(0)
摘要:
【学习笔记】JavaScript方法 定义方法 什么是方法? 方法是把函数放在对象的里面,对象只有两个东西:属性和方法 var Wzt = { name:'wzt', birth:2000, age:function () { var now = new Date().getFullYear(); 阅读全文
posted @ 2022-09-14 19:21
GrowthRoad
阅读(38)
评论(0)
推荐(0)
摘要:
【学习笔记】变量的作用域 在JavaScript中,var定义的变量实际是有作用域的。 假设在函数体中声明,则在函数体外不可以使用,会报错。如果非要使用,要使用闭包 <script> function zyy(){ var x = 1; } x = x + 1; </script> 如果两个函数使用 阅读全文
posted @ 2022-09-14 18:42
GrowthRoad
阅读(38)
评论(0)
推荐(0)
摘要:
【学习笔记】javascript函数 函数的定义 定义方式一 function abs(x){ if (x>=0){ return x; }else{ return -x; } } 一旦执行到return,代表函数结束,返回结果 如果没有执行return,函数执行完也会返回结果,结果是undefin 阅读全文
posted @ 2022-09-14 15:57
GrowthRoad
阅读(37)
评论(0)
推荐(0)