Josh Feinsilber Josh Feinsilber -3 years ago 131
Javascript Question

How to convert dot notation to string?

I was looking for a way to convert something in dot notation into a string using Javascript. Basically here's what I am looking for:

function dotToString(dotNotation){
return something;
}


dotToString(this.is.just.a.test);
// Would return "this.is.just.a.test"

Answer Source

Short answer: No

Long answer: When javascript passes an argument to a function, it passes in the value from the variable you are attempting to pass in. At no point does the dotToString function see this.is.just.a.test (It would see "blah", if this.is.just.a.test = "blah"). This is not possible.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download