I have an HTML form with two input fields to capture the location of the sun (i.e. 21 degrees Leo). One field is for astrological "sign" and one is for "degree". An example would be (sign: leo, degree: 21 ). I have an object set up to grab the values from the form as follows:
var userValues = {
sun: {
degree: myTrim(document.getElementById("sunDegree").value),
sign: myTrim(document.getElementById("sunSign").value)
}
};
Then a variable holds the concatenation of the two values:
var sunRelative = userValues.sun.sign + userValues.sun.degree;
The result is the following string:
sunRelative = "leo21";
I then need to convert that to an absolute degree by using sunRelative as the property in a call to an object called degreesAbsolute.
var sunAbsolute = degreesAbsolute.sunRelative;
But whenever I do a console.log() or alert() to display sunAbsolute, the variable is undefined.
However, if I type in the value "leo21" instead of using the variable sunRelative in the object call, like in the statement below, sunAbsolute evaluates properly.
var sunAbsolute = degreesAbsolute.leo21;
I have used typeof to validate that both of the values in the concatenation are strings, so I'm totally baffled. Any help would be appreciated.