Looking to extract specific values from a JavaScript object? Read on.
<script>
var market = "arizona";
var marketNumbers = {
"arizona" : "800 555-1234|866 452-8569",
"florida" : "800 555-4567|866 452-9999"
};
for (market in marketNumbers) {
var tmp = marketNumbers[market].split('|');
alert(tmp(0));
};
</script>
However, there seems to be an issue with the results. Instead of pipes separating the values, it's commas for some reason. Let's dig deeper.