jjzjj

undefined-reference

全部标签

javascript - jshint,eqnull,使用 '==='与 'undefined'进行比较

我提前道歉,我显然完全无法理解如何配置jshint。我有这行代码if(data==undefined||(typeofdata==='object'&&data.length===0)){...jshint在第一个==下划线并说Use'==='tocomparewith'undefined'.我添加了/*jshinteqnull:true*/。我认为这就是该选项的作用。我什至看到anexamplehere(搜索eqnull)。我错过了什么? 最佳答案 同样使用这个选项“-W041”:错误

javascript - 强制定向图错误, "Cannot Read Property ' Push' of Undefined"

我是编码新手,最近开始使用d3生成力导向图。使用链接派生节点时,我成功生成了一个四节点图。但是,当我明确列出节点时,我收到错误“UncaughtTypeError:Cannotreadproperty'push'ofundefined(d3.v3.min.js)”。我研究了对以下两个类似问题的回答,但无法使用答案解决此问题。我试图尽可能多地删除不相关的功能,谢谢。JavaScripterror"UncaughtTypeError:Cannotcallmethod'push'ofundefined"D3.jsUncaughtTypeError:Cannotcallmethod'push'

javascript - React/Redux reducer 在初始化期间返回 undefined

我正在开发我的第一个React/Redux项目。一切顺利,然后我尝试创建一个新的reducer。我认为这是一个非常简单的方法,但是当我加载页面时出现错误“ReducerX在初始化期间返回未定义”。跟踪表明这是在combineReducers()中发生的。我发现了几个类似的问题,但没有解决问题。关于这个问题:WhydoIget“Reducer[...]returnedundefinedduringinitialization”despiteprovidinginitialStatetocreateStore()?问题是他们在createStore()中使用了initialState,而我

javascript -/undefined 多次出现在我的 404 错误日志中

基本上在我的错误日志中我看到了很多:mysite.com/undefined(withreferercomingfromrandompagesofthewebsite)User-Agent:Mozilla/5.0(WindowsNT6.0)AppleWebKit/537.1(KHTML,likeGecko)Chrome/21.0.1180.89Safari/537.1(和其他一些用户代理)当然,我已经检查了HTML或DOM以查找带有/undefined或类似内容的链接,但什么也没有。我已经使用开发人员工具检查了网络选项卡,在这些页面上没有任何请求/undefined(使用我的chrom

javascript - 未捕获的类型错误 : Cannot read property 'name' of undefined

单击“选择文件”时,我有以下代码:$(':file').change(function(){if(this.files.length==1){$('#selected_files').html("Attaching"+this.files.length+"file");}else{$('#selected_files').html("Attaching"+this.files.length+"files");}$('#selected_files').append("FilenameSize");for(x=0;x"+name+"("+filesize(size)+")"+type+"

javascript - electron 的 remote.getGlobal() 在 window.location.replace() 之后返回 "undefined"

我一直在摆弄Electron的远程模块。在我的主进程中,我创建了这个变量:global.storage={};我的渲染器进程是用一个名为startup.html的文件初始化的。win.loadURL('file://'+__dirname+'/startup.html')在那里,我包含了一个包含以下函数的javascript文件:functionenterMain(value){remote.getGlobal('storage').exmpl=value;window.location.replace('./general.html');}我传递的值是“hello”,当调用...co

javascript - "Cannot read property ' 加载 ' of undefined"

我正在尝试关注this与Google登录集成的文档,尽管我在控制台中遇到此错误:未捕获的类型错误:无法读取未定义的属性“加载”atscript.js:1script.js:window.gapi.load('auth2',function(){console.log('Loaded!');});我有大约一半的时间收到错误,检查Chrome中的网络面板,只有当以下资源未加载时才会发生:https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.en.d2dliHDvPwE.O/m=auth2/exm=signin2/rt=j/sv=1

javascript - 为什么尾随逗号不会将 undefined 添加到 javascript 数组?

正在编写一个函数,该函数接受一个数字数组并返回true和索引(如果有缺失的数字)或false(如果没有缺失的数字)。我刚刚注意到一些让我困惑的数组。像这样的数组[,1,2,3,4]将打印[undefined,1,2,3,4]数组以逗号开头,输出对我来说有意义但是为什么[1,2,3,4,]//Noticethatthearrayendswithacomma打印[1,2,3,4]我假设输出是[1,2,3,4,undefined]。有谁知道为什么会这样吗? 最佳答案 尾随逗号(“省略”)被忽略:Ifanelementiselidedatt

javascript - 谷歌地图故障 : Closures & Passing By Reference

我遇到了一些Googlemap/Javascript问题。我想我知道问题出在哪里,但就是不知道解决办法。我的问题的一个例子是here.无论您点击什么标记,第二个都会出现。我显然将错误的信息传递到我的事件监听器中,但我似乎无法获得正确的代码。这是代码的一部分:首先,这是我的部分代码:if(GBrowserIsCompatible()&&mapResults!=null){//ReadintheJSONvarmapDetailsArray=loadJSON();//Createamapvarmap=newgoogle.maps.Map2(document.getElementById(el

javascript - Meteor.user().profile 返回 'profile' undefined

我有一个名为“isActive”的助手和一个名为“create”的模板..见下文Template.create.isActive=function(){returnMeteor.user().profile.isActive;};当我尝试运行此代码时,它会在控制台中返回以下内容:“模板助手中的异常:TypeError:无法读取未定义的属性‘profile’”。基本上我想从当前用户配置文件中提取“isActive”信息并将其返回到模板。知道为什么这不起作用吗?更新//startuponserverside:Meteor.publish("userData",function(){if(t