<!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 getSum() {
let sum = 1
for(let i in arguments){
sum *=arguments[i]
}
return sum
}
console.log(getSum(1,5,6,9))
</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( a = 1;a<=100;a++){
if(a % 7 == 0 ||a % 10 == 7|| parseInt(a / 10) ==7){
console.log(a);
}
}
</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 tz(n){
if(n <= 3) {
return 1;
}else{
return tz(n - 3) + tz(n - 1);
}
}
console.log(tz(20))
</script>
</body>
</html>
笔记
需要定义未知量
new date () 获取当前时间
(包括年月日等等)
Date获取当前时间的时间对象
获取当前年份
Date.getfullyear()
获取当前月份
Date。Getmonth()+1
获取当前日
Date。Getdate()
获取当前时
Date.gethours ()
获取当前分
Date.getminutes ()
获取当前秒
Date.getsecond()
获取当前星期几
Date。Getday()
获取当前毫秒数
Date.Getmilliseconds()
获取时间戳
date.gettime()
字符串对象
、
连接字符串
方法一:Str3=Str1.concat(str2)
Str3.match(/\d/g)
使用正则替换原来的内容
Sfr3.replace(/a/g,”(需要换东西)”)
截取
Str3.Slice(序列,序列)
分割(以参数进行分开)
Split(“参数”)
用。。。拼接
Join(“参数”)
转大写,转小写
名字倒写
函数
一段独立功能的代码的集合
引入自定义函数的基本架构
同C语言一致
在函数没有return下,默认返回undefined
作用域
Arguments 用于承接用户发出数据
匿名函数
箭头函数
同上面一个意思
递归:自己调用自己