Y.Lang.isUndefined vs typeof undefined, which is better and why?
问题 I was wondering why YUI libs use Y.Lang.isUndefined() even when JS has a built in feature to check type of a variable. 回答1: The reason that method exists is for API consistency -- the YUI team felt it would be weird to leave it out. As LightStyle points out, isUndefined() doesn't do anything special, so you probably shouldn't use it unless you really like the aesthetics. In fact, only a few of the YUI type checking methods do any actual useful work beyond what you could do natively. Ryan