SOURCE

console 命令行工具 X clear

                    
>
console
class Person{
    constructor(value){//构造器
        this.value = value;
        this.sayHello = function(){//实例方法
            console.log("hello")
        }
    }
    get value(){
        return this.value;
    }
    
    static sum(a,b){//静态方法
        return a+b;
    }
    sayHi(){//原型方法
        console.log("hi");
    }
}
let person = new Person(1);
console.log(person);//实例化一个对象   {"value":1}
//console.log(Person.sayHello());会报错 这是实例的方法
console.log(Person.sum(1,2));//3
person.sayHello();//hello
//Person.sayHi();//会报错
person.sayHi();//hi
person.sayHi = function(){console.log("not Hi")};
person.sayHi();// not Hi
person.sayHello = function(){console.log("not Hello")};
person.sayHello();//not Hello



<!-- <div id="test">123</div>
<style>
    @media screen and (max-width: 300px) {
    #test {
        height:100px;
        width:100px;
        background-color:lightblue;
    }
}
</style> -->