-1

I have following datas:

var formFeilds={
            'text':  {
                'T1':{'required':true,'min':25,'max':55},
                'T2':{'required':true,'min':2,'max':5}
            } 
            ,'text2':5
        };
function findObj(obj){
return key,itsobj
}

I want take text1, text2 Objects and their names and related objects. For example findObj(formFeilds) would return (text,formFeilds.text AND text2,5) also findObj(formFeilds.text) would return (T1,formFeilds.text.T1 AND T1,formFeilds.text.T2) I need check returned values are object or not in jquery

3
  • Return it as an array? Also, 5 is not an object. Commented Mar 10, 2012 at 22:37
  • 1
    Your objects don't seem very array-like to me. Commented Mar 10, 2012 at 22:38
  • No. I want return all things as exists including int,obj,text,... then I need it be checked for being object or not seperatly. Commented Mar 10, 2012 at 22:40

1 Answer 1

1

I need check returned values are object or not in jquery

You can use the native Javascript typeof operator but keep in mind that almost everything is an object in JS except string|boolean|number|null|undefined.

Sign up to request clarification or add additional context in comments.

9 Comments

Caveat: typeof thinks null is an object.
Yeah, JS and its things...But that's the general rule of objects
@Huseyin: Yes, formFeilds is an object isn't it?
@pimvdb yes it is an object with multiple contents.
I don't know if this is what you're after but this quick example with your code gives me, predictably, typeof formFields.text2 // Number so it works...jsfiddle.net/elclanrs/zPkPV
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.