arguments
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function fun() {
console.log("这是一个函数对象");
console.log(arguments.length);
console.log(arguments[0]);
console.log(arguments.callee);
console.log(arguments.callee==fun);
}
fun("false",undefined);
</script>
</head>
<body>
</body>
</html>
Date对象
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var date=new Date();
console.log(date);
var date2=new Date("02-20-2019 1:2:3");
console.log(date2);
var a=date2.getDate();
console.log(a);
var b=date2.getDay();
console.log(b);
var c=date2.getMonth();
console.log(c);
var d=date2.getFullYear();
console.log(d);
var e=date2.getTime();
console.log(e);
var date3=new Date("1/1/1970 0:0:0");
var f=date3.getTime();
console.log(f);
var datenow=Date.now();
console.log(datenow);
var start=Date.now();
for (let i = 0; i < 100; i++) {
i+=1;
console.log(i);
}
var end=Date.now();
console.log(end-start);
</script>
</head>
<body>
</body>
</html>
Math
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
console.log(Math.PI);
console.log(Math.abs(-4));
console.log(Math.ceil(4.1));
console.log(Math.floor(4.9));
console.log(Math.round(4.4));
console.log(Math.round(4.5));
console.log(Math.random());
console.log(Math.max(1,4,3,12,64));
console.log(Math.min(1,3,52,2,7,342,6));
console.log(Math.pow(2,3));
console.log(Math.sqrt(4));
</script>
</head>
<body>
</body>
</html>
包装类
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var number = new Number();
number.hello="这是";
console.log(number.hello);
var test=1;
var a=test.toString();
console.log(typeof test);
console.log(typeof a);
</script>
</head>
<body>
</body>
</html>
字符串的方法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var str="等哈武汉打完了";
console.log(str.length);
console.log(str.charAt(0));
console.log(str.charCodeAt(0));
console.log(String.fromCharCode(31561));
console.log(str.concat("大王"));
console.log(str.indexOf("了"));
console.log(str.indexOf("汉",1));
console.log(str.lastIndexOf("汉"));
console.log(str.slice(1,4));
console.log(str.slice(1,-2));
console.log(str.slice(2));
console.log(str.substring(1,4));
console.log(str.substr(1,4));
console.log(str.split("汉"));
console.log(str.split(""));
str="AIDADAOWID大王";
console.log(str.toLowerCase());
str="aawfafaf";
console.log(str.toUpperCase());
</script>
</head>
<body>
</body>
</html>
正则表达式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var a=new RegExp("a");
console.log(a);
console.log(typeof a);
console.log(a.test("dd"));
console.log(a.test("dad"));
console.log(a.test("A"));
var b=new RegExp("a","i");
console.log(b.test("A"));
</script>
</head>
<body>
</body>
</html>
|