added note about UpperCamelCase for ES6 classes (#26979)
* added note about UpperCamelCase for ES6 classes proposed note in issue #17864 * added note as a new heading changed from note as a sentence to note as a heading plus the actual note * added <code> around SpaceShuttle * removed markdown and added <strong> tag
This commit is contained in:
		| @@ -12,7 +12,9 @@ In ES5, we usually define a constructor function, and use the <code>new</code> k | |||||||
| <blockquote>var SpaceShuttle = function(targetPlanet){<br>  this.targetPlanet = targetPlanet;<br>}<br>var zeus = new SpaceShuttle('Jupiter');</blockquote> | <blockquote>var SpaceShuttle = function(targetPlanet){<br>  this.targetPlanet = targetPlanet;<br>}<br>var zeus = new SpaceShuttle('Jupiter');</blockquote> | ||||||
| The class syntax simply replaces the constructor function creation: | The class syntax simply replaces the constructor function creation: | ||||||
| <blockquote>class SpaceShuttle {<br>  constructor(targetPlanet){<br>    this.targetPlanet = targetPlanet;<br>  }<br>}<br>const zeus = new SpaceShuttle('Jupiter');</blockquote> | <blockquote>class SpaceShuttle {<br>  constructor(targetPlanet){<br>    this.targetPlanet = targetPlanet;<br>  }<br>}<br>const zeus = new SpaceShuttle('Jupiter');</blockquote> | ||||||
| Notice that the <code>class</code> keyword declares a new function, and a constructor was added, which would be invoked when <code>new</code> is called - to create a new object. | Notice that the <code>class</code> keyword declares a new function, and a constructor was added, which would be invoked when <code>new</code> is called - to create a new object.<br> | ||||||
|  | <strong>Note</strong><br> | ||||||
|  | UpperCamelCase should be used by convention for ES6 class names, as in <code>SpaceShuttle</code> used above. | ||||||
| </section> | </section> | ||||||
|  |  | ||||||
| ## Instructions | ## Instructions | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user