Fix(Curriculum): Constructor function not explained before ES6 #17865 (#35463)

* Fix(Curriculum): Constructor function not explained before ES6 #17865

* Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.english.md

Co-Authored-By: hilliarj <hilliarj@dickinson.edu>

* Update to #17865 PR

Fix(Curriculum): Constructor function not explained before ES6. Used an unordered list and the syntax that others recommended.
This commit is contained in:
Justin Hilliard 2019-03-26 12:53:19 -04:00 committed by Randell Dawson
parent 532b1d2232
commit 8b5ef8cfdd

View File

@ -13,8 +13,9 @@ In ES5, we usually define a constructor function, and use the <code>new</code> k
The class syntax simply replaces the constructor function creation:
<blockquote>class SpaceShuttle {<br>&nbsp;&nbsp;constructor(targetPlanet){<br>&nbsp;&nbsp;&nbsp;&nbsp;this.targetPlanet = targetPlanet;<br>&nbsp;&nbsp;}<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.<br>
<strong>Note</strong><br>
UpperCamelCase should be used by convention for ES6 class names, as in <code>SpaceShuttle</code> used above.
<strong>Notes:</strong><br><ul>
<li> UpperCamelCase should be used by convention for ES6 class names, as in <code>SpaceShuttle</code> used above.</li>
<li> The constructor method is a special method for creating and initializing an object created with a class. You will learn more about it in the Object Oriented Programming section of the Javascript Algorithms And Data Structures Certification.</li></ul>
</section>
## Instructions