0

... but I can't for the life of me figure it out.

I have an object that comes from an application which has a Status property, and within that property is Name and Key. So I can do things like object.Status.Name = x.

I have created another of these objects within my site and currently the value of the status field is set to 0 by default. If I want to populate the Status field to at least get a specific value in the object.Status.Name field how would I go about it?

object.Status.Name = x doesn't seem to work and instead creates object.StatusName = x when run.

Thanks in advance

Mike

2
Contributors
2
Replies
18
Views
2 Years
Discussion Span
Last Post by Mike Askew
0

Anything you can tell about the inner workings of that object?

Because if I try something like:

        var Object = function(){
            this.Status = {
                Name : "foo"
            };
        };
        var object = new Object();

        // prints foo
        console.log(object.Status.Name);

        object.Status.Name = "bar";

        // prints bar
        console.log(object.Status.Name);

Or

        var Object = function(){
            this.Status = new Status();
        };

        var Status = function(){
            this.Name = "foo";
        };

        var object = new Object();

        // prints foo
        console.log(object.Status.Name);

        object.Status.Name = "bar";

        // prints bar
        console.log(object.Status.Name);

Nothing seems the matter.

0

Yeah misworded it slightly I believe eventually worked out what I was trying to do with a spot of googling.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.