use*_*105 0 javascript jslint jshint grunt-contrib-jshint
正在此Missing "use strict" statement,即使它在文件的顶部,它混淆了我decalred.对于第10行和第12行,此错误出现两次.
'user strict';
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host : 'http://localhost:9200'
});
client.search({
index: 'twitter',
type: 'tweets'
}).then(function (resp) {
var hits = resp.hits.hits;
}, function (err) {
console.trace(err.message);
});
Run Code Online (Sandbox Code Playgroud)
上面的代码主要是从http://www.fullscale.co/elasticjs/复制和粘贴
看来你犯了一个错字.
它应该是
'use strict';
Run Code Online (Sandbox Code Playgroud)
如果您想了解更多关于'use strict',如何使用它以及实际操作的内容,您可以查看以下页面:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode