How prototype inheritance can affect method overriding in JavaScript?

Here’s the code,

            function extend(child, parent){
				child.prototype = Object.create(parent.prototype);
				child.prototype.constructor = child
			//Super Class
			var Mobile = function(){
			//Prototype Method = function(){
				return "Super Class Method";
			//Sub class 
			var Samsung = function(){
            // 1. 
			// extend(Samsung, Mobile); //displays "Sub Class Method" = function(){
				return "Sub Class Method";
			// extend(Samsung, Mobile); //displays "Super Class Method"
			var sam = new Samsung();

When I extend Samsung.prototype with Mobile.prototype before initializing the prototype method show() for Samsung, I get to see the show() method of Samsung.prototype, But writing it after initialization provides me with show() method of Mobile.prototype. Could someone please explain what’s happening in the background?