1211zuoye

获取当前时间对应的时间对象new Date
年date.getFullyear()
月date.getMonth() + 1月  默认从0开始
日date.getDate()
时date.getHours()
分date.getMinutes()
秒date/getSeconds()
星期date.getDay()
毫秒date.getMilliseconds
获取时间戳date.getTime 1970-1-1 0:0到当前时间对象的毫秒数
字符串对象
1. ``   "" ''
2.String new String
String("")
length返回字符串长度
字符串方法
获取下标对应的字符charAt
从左往右获取对应的下标IndexOf
从右往左获取对应的下标lastIndexOf
拼接str1.contsct(str2)
使用正则匹配想要的内容str.math(/ /g)
使用正则替换str.replace(/ /g," ")
截取str.slice( , )
按照特定的符号分割字符串str.spilt("")转化为数组
拼接str.join(" ")
转大写str.toUpperCase()
转小写str.toLowerCase()
函数时一段具有独立功能的代码的集合
function 函数名(参数){
代码块
}
调用:函数名()
函数执行完的结果通过return返回
函数在声明之前可以调用
值传递和引用传递
作用域:变量名生效的范围  全局作用域,函数作用域
函数里声明的变量函数外不能被访问
函数作为参数进行传递
默认值参数
function a(r,PI=3.14)
默认值参数放在所有参数的最后面
arguments对象
arguments会把
匿名函数function ()
let 函数名 = (参数) => 代码块
递归:函数自身调用自身
要有递归出口

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function getchen () {
            let a = 1
            for (let i in arguments){
            a *= arguments[i]
        }return a
        }
        let o = getchen(2,4,3)
        alert(o)
    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
       
            for(let i  =1;i<=100;i++){
                if(i % 7 === 0||i / 10 === 7||i%10==7){
                alert(i)
            }
        }
          
    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function add(n){
            if(n <= 3){
                return 1
            }
            else{
                return n-3 +add(n-3)
            }
        }
        
        alert(add(4))
    </script>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值