Calling functions in Object.Prototype from Object

I added a function to Object.prototype using Object.prototype.func = function () {...} but when I try to call it using Object.func() it throws an error that it is not defined in Object.

Answers


Everything in JavaScript is an object and inherits from Object (including Object). If there's a property on Object.prototype then EVERYTHING can access it because it is in everything's prototype.

http://jsfiddle.net/PxLDu/1/


Need Your Help

Releasing an object with NSDate object as property

objective-c memory-management nsdate

I created an object with a NSDate property like this:

using apache fop with PipedOutputStream

java jaxb inputstream outputstream fop

I want to build a pdf-file from a jaxb-object using apache fop to generate and itext PdfStamper to modify it. since fop writes to an outputStream and PdfStamper reads from InputStream my idea was t...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.