Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: Determine undefined

Expand Messages
  • Jing Ceawlin
    Thanks. I just think val === undefined could be a little more efficient than typeof val === undefined .
    Message 1 of 3 , Jan 31, 2008
    • 0 Attachment
      Thanks. I just think val === undefined could be a little more efficient than typeof val === 'undefined'.

      On Jan 31, 2008 11:00 PM, y_lsmith <lsmith@...> wrote:

      --- In ydn-javascript@yahoogroups.com, "Jing Ceawlin" <zjply4000@...>


      wrote:
      >
      > What I don't understand is, can't we just do it like this:
      > isUndefined : function(o) {
      > return o === undefined;
      > }

      Jing,

      Most of the YAHOO.lang.is___ methods wrap simple operations. There
      are some that address more subtle nuances in the language. However,
      providing methods for common validations allows code authors to use a
      consistent syntax for ease of readability and maintainability.

      In the case of isUndefined, yes, you can verify val === undefined or
      typeof val === 'undefined'.

      Hope this helps,
      Luke


    Your message has been successfully submitted and would be delivered to recipients shortly.