You should not create an instance of Parent to set the prototype part of inheritance (use Child.prototype=Object.create(Parent.prototype);Child.prototype.constructor=Child).
Constructor functions should start with a Capital (upper case letter).
You could inherit by stuffing everything in the constructor (first example) function and in Child do Parent.apply(this,arguments);
but Child will be unable to extend Parent functions and it'll take more cpu and memory to create instances of Child and Parent.
The way your second example uses prototype is wrong, you set shared behaviour as an instance member (cry function) and instance specific member on Duck prototype (name member). As for the advantages of using prototype (if done correctly) over the first example you've provided:
- You can re use parent functions in Child and extend on them if you want
- It uses less memory and less cpu to initialize instances because prototype members are shared.
- You could add behaviour on the prototype after creating instances and have all existing instances have that behaviour.
- Other JS programmers would understand your code better and think you know what you're doing.
More details about constructor functions and prototype can be found here.