Search code examples
javascriptprototypejsprototype

Prototype framework or included in js


I have a quick question. On some pages I read that the prototype function in js comes from a framework called prototype written in 2005. But you can use it without loading an external script. Now my question is: is prototype now standardized in javascript? So that you don't need to load external scripts?

Maybe my question is: Is a framework only a framework if it is included as a script?


Solution

  • The Prototype framework (for clarity often called Prototype.js) uses the native prototype functionality that was always standardized and available natively in JavaScript.

    I read that the prototype function in js comes from a framework

    If you read that a prototype method comes from the framework, it means that you would have to include the framework to use this particular method. However, some of the methods that Prototype.js had written in 2005 to extend the native objects (like Array, Function etc) - or actually, their prototypes - later became part of the standard. It means that in newer browsers you don't need the framework for these methods, but you still need to include it when your scripts should work in old browsers or when you use non-standard methods.