// function C1(name) { if (name){this.name = name,console.log('进入了')} }
// function C2(name) { this.name = name }
// function C3(name) {this.name=name||"John"}
// C1.prototype.name = 'Tome'
// C2.prototype.name = 'Tome'
// C3.prototype.name = 'Tome'
// alert(new C1().name)
// alert(new C2().name)
// alert(new C3().name)
// function Fn() {
// this.x = 100;
// this.y = 200;
// this.getX = function () {
// console.log(this.x);
// }
// }
// Fn.prototype.getX = function () {
// console.log(this.x);
// };
// Fn.prototype.getY = function () {
// console.log(this.y);
// };
// let f1 = new Fn;
// let f2 = new Fn;
// console.log(f1.getX === f2.getX);
// console.log(f1.getY === f2.getY);
// console.log(f1.__proto__.getY === Fn.prototype.getY);
// console.log(f1.__proto__.getX === f2.getX);
// console.log(f1.getX === Fn.prototype.getX);
// console.log(f1.constructor);
// console.log(Fn.prototype.__proto__.constructor);
// f1.getX();
// f1.__proto__.getX();
// f2.getY();
// Fn.prototype.getY();
let arr = [1,2,3,4,5,6,7,8]
function contains(arr,val){
return arr.some(item=>item===val)
}
function contains2(arr,val){
return arr.filter(item=>item===val).length>0
}
console.log(contains(arr,6))
console.log(contains2(arr,7))
console.log(arr.some(item=>item===5))
console.log(arr.filter(item=>item===8).length>0)
console.log(arr.indexOf(8))
console.log(7%3)
let str = '21312311'
console.log(str.split(''))
console.log([...str])
function fn(){
console.log(this.a)
}
var a = 1;
fn()
for(let i in arr){
console.log(i)
}
console