constructor.name is undefined in Internet Explorer

前端 未结 6 1300
孤独总比滥情好
孤独总比滥情好 2021-02-13 05:11

My debugging work in IE ended today by finding that constructor.name is undefined.

I created the following simple code that reproduces the issu

6条回答
  •  一个人的身影
    2021-02-13 05:43

    easy fix without "changing syntax" or polyfill ;)

    var car = new Car('ferrari');
    

    ES6

    car.constructor.name === 'Car'
    

    ES5 (IE)

    car.constuctor === Car
    

提交回复
热议问题