Console.log不是javascript中的函数错误
console.log is not a function - error in javascript
我得到错误,console.log
不是一个函数,但这在过去并不是一个问题。错误发生在第一个和第二个console.log
,它没有通过那里。
我有分号,所以我不确定到底是什么问题?
document.getElementById("fileToRead").addEventListener("change",function(event) {
var input = document.getElementById("fileToRead");
//Variable for if statement to see if there is a header in the file.
var headerType = false;
console.log(input);
input = event.target.files[0];
console.log('test');
for(var i = 0; i < input.files.length; i++){
var files = input.files[i];
Papa.parse(files, {
header:headerType,
dynamictyping:true,
complete:function(results){
console.log(results);
var input = results.data;
if(headerType === false){
input.forEach(function(input){
jsonData.theData = theData;
var singleEntry = {
"symbol" : input[0],
"date" : input[1],
"open" : input[2],
"high" : input[3],
"low" : input[4],
"close" : input[5],
"volume" : input[6]
};
jsonData.theData.push(singleEntry);
return jsonData;
}); // End forEach loop
} else {
} // End if statement for headerType
document.getElementById("editor").innerHTML = JSON.stringify(jsonData.theData);
} // End Callback Complete
}); // End PapaParse
} // End for loop
});
我甚至把代码注释掉了,所以这是最终的结果,它仍然说console.log
不是一个函数!
// This is for the views/admin.ejs file only
//This file describes how the Admin page works, hiding divs and working with the data
// importing
var jsonData = {};
var theData = [];
document.getElementById("fileToRead").addEventListener("change",function(event) {
// var input = document.getElementById("fileToRead")
// //Variable for if statement to see if there is a header in the file.
// var headerType = false;
// input = event.target.files[0];
console.log('test');
// for(var i = 0; i < input.files.length; i++){
// var files = input.files[i];
// Papa.parse(files, {
// header:headerType,
// dynamictyping:true,
// complete:function(results){
// console.log(results);
// var input = results.data;
// if(headerType === false){
// input.forEach(function(input){
// jsonData.theData = theData;
// var singleEntry = {
// "symbol" : input[0],
// "date" : input[1],
// "open" : input[2],
// "high" : input[3],
// "low" : input[4],
// "close" : input[5],
// "volume" : input[6]
// };
// jsonData.theData.push(singleEntry);
// return jsonData;
// }); // End forEach loop
// } else {
// } // End if statement for headerType
// document.getElementById("editor").innerHTML = JSON.stringify(jsonData.theData);
// } // End Callback Complete
// }); // End PapaParse
// } // End for loop
});
我已经将控制台重新定义为代码下面的函数!完成新手错误......希望我不会再犯这样的错误。
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Javascript搜索函数错误
- Chrome Javascript日期构造函数错误
- 浏览器中出现javascript初始大写函数错误
- Createjs冲突问题localToLocal不是函数错误
- Java脚本函数错误
- 更新带有Javascript函数错误的变量
- 如何将对象插入对象列表的开头,当它有 unshift 不是函数错误
- 在将 Pickadate 与 Meteor 一起使用时,未定义不是函数错误
- 运行咕噜咕噜咕噜抛出 _.object 不是函数错误
- 了解函数(错误、数据)回调
- javascript中的typeof()函数错误
- 我一直在获取angularjs服务不是函数错误(LoginService.login不是函数)
- HTML5拖拽&drop正在抛出undefined不是函数错误
- Google Maps API a.lat不是函数错误
- getItemAtIndex不是函数错误
- Javascript停止函数错误
- 对话框函数错误无效函数
- Javascript 自定义函数错误
- 因果报应单元测试'未定义'不是函数错误