What is the difference between these two entries?

Where the difference between
CreateNewElement = Object.create(AllElemetsParent);

and
CreateNewElement.prototype = AllElemetsParent;
?
June 10th 19 at 15:05
1 answer
June 10th 19 at 15:07
Solution
in 1 case, You just create a new object based on the prototype AllElemetsParent and assign it to a variable CreateNewElement
in the 2nd case, you assign the prototype property of the object CreateNewElement a reference to what is stored in AllElemetsParent if CreateNewElement function, when calling it with new operator will create a new object based on the prototype AllElemetsParent it will come to function as the this object and will be returned by the new operator

Find more questions by tags JavaScript