javascript associative array initialization error? -
<script> var tids = { 308: 1, 312: 1, 313: 1, 314: 1 }; </script>
results in "missing } in xml expression arrow pointing first colon in js error console. isn't valid declaration?
first should fix <script>
tag to
<script type="text/javascript">
next, if want use numeric indexes, try declare them string:
var tids = { '308': 1, '312': 1, '313': 1, '314': 1 };
please note, however, not able reference them in object notation (i.e. tids.308
). use arrays instead of objects:
Comments
Post a Comment