why is class a reserved word in JavaScript?

后端 未结 5 1863
渐次进展
渐次进展 2020-11-29 08:25

I am planning to implement class inherit interface using JavaScript. class is the perfect word as the name of the constructor.

class = function          


        
5条回答
  •  一整个雨季
    2020-11-29 08:41

    Languages evolve. It is prudent to reserve a few keywords that might come in use later. According to the ECMA standard, class is a Future Reserved Word.

    If you did not reserve them, introducing new keywords could conflict with existing code (which already might be using the word for other things). Happened with Java and assert.

提交回复
热议问题