Frederik Witte
Frederik Witte

Reputation: 1345

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?

Upvotes: 1

Views: 158

Answers (2)

Bergi
Bergi

Reputation: 664579

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.

Upvotes: 2

Vic
Vic

Reputation: 12527

Prototype.js (the framework) and the prototype-based model that JavaScript uses have nothing in common. The framework was probably named that way because it extends (some pronounce this as "pollutes") most of the native JavaScript prototypes (Array, Object, Function, etc). You are definitely not using the Prototype framework without specifically loading it.

Upvotes: 3

Related Questions