var aType = function() {}
aType.prototype = new String
// We can create a simple type using the code above.
// Use new aType() to use that type.
aType.prototype.hello = function(text) {
return {
"a": this,
"b": text
}
}
// And use the code above to create a prototype that goes into the type we created by default.
var newaType = new aType()
console.log(newaType.hello())
// Create a variable called newaType and put that
// This code is a simple code that prints the value of executing its prototype hello to the console.
FYI, I'm not American, so I used a translation.
Please understand if my writing is wrong :)
Stringtype using its prototype?Inheritance in Javascripton web search.let obj = new Smth()), you create a " structure of type Object around a structure called prototype(==Smth.prototype in my example) ".