请教 eval为什么解析不了一维数组
var hot_cities = eval( [ "bhok ", "ngkok ", "cvkok ", "gok ", "tngkok ", "agkok ", "Bangkok "] );
hot_cities的结果为undefined
如何使hot_cities保存以上数据
------解决方案--------------------var hot_cities = [ "bhok ", "ngkok ", "cvkok ", "gok ", "tngkok ", "agkok ", "Bangkok "];
这个明显定义数组么
------解决方案--------------------var hot_cities =new Array( "bhok ", "ngkok ", "cvkok ", "gok ", "tngkok ", "agkok ", "Bangkok ");
------解决方案-------------------- <script language=javascript>
var hot_cities = eval( '[ "bhok ", "ngkok ", "cvkok ", "gok ", "tngkok ", "agkok ", "Bangkok "] ');
alert(hot_cities[0])
</script>