Announcement

Collapse
No announcement yet.

return an object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • return an object

    just a quick one... I am writing a few functions/methods, and I want to pass an object when they are done, but I cant figure out how to do it.

    i can return an array

    return new Array ( a, b, c, d, e);

    but I want to return an object with properties

    obj.a
    obj.b
    obj.c, etc

    return new Object (obj);

    doesnt work and I have been searching the net.. any feed back would be really appreciated

  • #2
    Re: return an object

    just create an object and return the object.

    var obj={};
    obj.a=1;
    obj.b=2;
    obj.c=3;
    return obj;


    Originally posted by eurostoxx
    just a quick one... I am writing a few functions/methods, and I want to pass an object when they are done, but I cant figure out how to do it.

    i can return an array

    return new Array ( a, b, c, d, e);

    but I want to return an object with properties

    obj.a
    obj.b
    obj.c, etc

    return new Object (obj);

    doesnt work and I have been searching the net.. any feed back would be really appreciated

    Comment


    • #3
      thank you kindly

      I guess I overcomplicated the matter...

      Comment


      • #4
        Hi eurostoxx,

        You are most welcome, good to hear it helped,

        Steve

        Originally posted by eurostoxx
        thank you kindly

        I guess I overcomplicated the matter...

        Comment

        Working...
        X