Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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


Win a copy of The Software Craftsman this week in the Agile forum!
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: 62298
    
  68

It doesn't.


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

Joined: Nov 08, 2001
Posts: 15383
    
    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: 62298
    
  68

Or check argument types with the typeof operator. But method overloading as it's known in Java does not exist.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Overloading in JavaScript