<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=
, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
for(let i=0;i<5;i++){
console.log(i);
}
const m=2;
console.log(m);
var str="hello.vue";
console.log(str.includes("vue"));
console.log(str.startsWith("h"));
console.log(str.endsWith("ue"));
let arr=[1,2,3];
const[x,y,z]=arr;
console.log(x,y,z);
let person={
id: 1,
age: 20,
name: 'hzc'
};
const{id,name,age}=person;
console.log(id,name,age);
var print=function(obj){
console.log(obj);
}
var print2=obj => console.log(obj);
print('aaa');
print2('aaa');
var sum=function(a,b){
return a+b;
}
var sum2=(a,b) => {return a+b};
console.log(sum(1,2));
console.log(sum2(2,3));
let student={
name: 'jack',
eat:function(food){
console.log(this.name+"不吃"+food);
},
eat2: food=>console.log(this.name+"不吃"+food),
eat3(food){
console.log(this.name+"在吃"+food);
}
}
student.eat('banana');
student.eat2('香蕉');
student.eat3('water');
arr1=['1','2','3'];
console.log(arr1);
arr1=arr1.map(s=>parseInt(s));
console.log(arr1);
const arr2=[1,20,-5,3];
var n=arr2.reduce((a,b)=>a+b);
console.log(n);
</script>
</body>
</html>
|