When coding a library in JavaScript, what is the most standard (friendliest?) way to handle invalid input to a function? My gut tells me that returning undefined is perfectly fine, but is it actually more helpful to throw an error instead? Or does it really not matter?
I could also see returning false, null or even -1, but I don't think those would be as widely expected.
(If this question is too subjective, I'm happy to make it cw.)