This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
JavaScript allows multiple class members with the same identifier, and the last duplicate class member takes precedence over previous declarations, which is undesired behavior. Disallow duplicate class members.
classA{foo(){}bar(){}}classA{staticfoo(){}foo(){}}classA{getfoo(){}setfoo(value){}}classA{staticfoo(){}getfoo(){}setfoo(value){}}classA{foo(){}}classB{foo(){}}classA{[foo](){}foo(){}}classA{'foo'(){}'bar'(){}baz(){}}classA{*'foo'(){}*'bar'(){}*baz(){}}classA{get'foo'(){}get'bar'(){}getbaz(){}}classA{1(){}2(){}}classA{['foo'](){}['bar'](){}}classA{[`foo`](){}[`bar`](){}}classA{[12](){}[123](){}}classA{[1.0](){}['1.0'](){}}classA{[0x1](){}[`0x1`](){}}classA{[null](){}[''](){}}classA{get['foo'](){}set['foo'](value){}}classA{['foo'](){}static['foo'](){}}// computed "constructor" key doesn't create constructor
classA{['constructor'](){}constructor(){}}classA{'constructor'(){}[`constructor`](){}}classA{constructor(){}get[`constructor`](){}}classA{'constructor'(){}set['constructor'](value){}}// not assumed to be statically-known values
classA{['foo'+''](){}['foo'](){}}classA{[`foo${''}`](){}[`foo`](){}}classA{[-1](){}['-1'](){}}// private and public
classA{foo;staticfoo;}classA{foo;#foo;}classA{'#foo';#foo;}