If you are trying to extend a function prototype and accessing the String prototype. You are misunderstanding the prototype inheritance concept
var arr = ['test'];
var string = 'test';
var someMethod = function(){ /* some code */ };
Array.prototype.print = function(){
console.log(this);
}
String.prototype.print = function () {
console.log(this);
}
//Extending the prototype of Function
Function.prototype.print = function () {
console.log(this);
}
arr.print(); // logs the arr with value 'test'
string.print(); //logs string.print is not a function
someMethod.print(); // this will trigger the print method
// extended in Function Prototype.
Update
Very interesting point I realised due this post in Javascript. It is
you can treat Function prototype as other prototoypes. Imagine you are
extending the functions of a function itself ( seems like one of a
kind inception ). So there are interesting methods like call, apply ,
bind. So we can extend the functionality of even a function. Correct me if I am wrong, Unlike
in any other language I can think of, where extending function seems
to be impossible. Given that we are not given privilege to touch the
source code of that language. Very powerful feature in JS.
Function.prototype.print=>String.prototype.print