[Javascript] Object Not Defined

Terry Riegel riegel at clearimageonline.com
Mon Nov 21 15:45:50 CST 2011


> Right now you are restricting yourself into only gettingwhat you need and substitute its absence. But soon you will be ableto think backwards :) [code retroactively]; "I will create a Title for this content only if a given content structure implies one. Therefore, if the title is declared, I will create a title element,if not, the kind of this content doesn't need a title, but if the title is undefined\empty\left blank or so, I will substitute it withsay "Untitled"; etc., etc."

I think you are confusing the specifics of my example with my question. I had no intention of creating a title tag in HTML.

For clarity I am interested in a function that will generally check for the existence of an object.

I have done some googling around and am not able to find any type of generalized solution.

I may be stuck with the long drawn out object detection like a a.b a.b.c etc

I suppose I could send a string to a function then split the string on the . and then iterate through it to check for existence...

pseudo code...

exist('a.b.c.d.e.f')


function exist(text)
 if typeof === string
  t=split(text,'.')
  iterate through t checking for existence break when not defined
 else
  return 'bad syntax'
 /if
 return true  or false
/function



Terry


More information about the Javascript mailing list