【发布时间】:2020-01-25 21:27:42
【问题描述】:
我有一个如下所示的文本文件(不是 json):
['a', 'b', 'c', 'd']
['e', 'f', 'g', 'h']
我如何读取它并放入 2 个数组:['a', 'b', 'c', 'd'] 和 ['e', 'f', 'g', 'h']?
我正在使用它来读取文件:
jQuery.get('filename.txt', function(data){
alert(data);
});
【问题讨论】:
-
文本文件中的值是否看起来像
[a, b, c, d]或['a', 'b', 'c', 'd']? -
@ajaiJothi 哦,我的帖子搞错了。看起来像
['a', 'b', 'c', 'd']
标签: javascript arrays text