18.instanceof关键字

2019-06-06  本文已影响0人  Fl_来看看

1.什么是instanceof关键字?

2.instanceof注意点

  function Person(myName) {
            this.name = myName;
        }
        function Student(myName, myScore) {
            Person.call(this, myName);
            this.score = myScore;
        }
        Student.prototype = new Person();
        Student.prototype.constructor = Student;

        let stu = new Student();
        console.log(stu instanceof Person); // true
上一篇下一篇

猜你喜欢

热点阅读