我想将ndjson文件中的数据分配给一个js变量。我试着把它放在一个数组和一个对象中,但这会抛出错误。
我试过这样做...
var data = [{"attributes":{}}
{"attributes":{}}
{"attributes":{}}]
和
var data = {{"attributes":{}}
{"attributes":{}}
{"attributes":{}}}
但这是行不通的。
有没有人可以帮我把这个ndjson值赋值给一个js变量而不抛出错误。
我正在寻找把一个NSArray从viewControer.m文件发送到data.js文件,但是它没有在JavaScript中打印任何东西。以下是我的密码。
在我的视图加载方法中
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
CDV=[[CDVViewController alloc]init];
news=[[NSArray alloc]initWithContentsOfFile:[[
<p style="line-height: 18px; font-size: 18px; font-family: times;">
Click "<i>Load samples</i>" to view and edit more JS samples.<br>
<br>
Labyrinth generated with JavaScript:<br><br>
<script>
var n = 100;
var sample = [];
for (var i =