File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Overloading in JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Overloading in JavaScript" Watch "Overloading in JavaScript" New topic
Author

Overloading in JavaScript

Dan Silva
Ranch Hand

Joined: Sep 05, 2007
Posts: 86
How does overloading in JavaScript work? I'm trying to do it, but it doesn't seem to like it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

It doesn't.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Most people will add an object to the end and add any differences there.


also you can check the arguments.length;



Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Or check argument types with the typeof operator. But method overloading as it's known in Java does not exist.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Overloading in JavaScript