草庐IT

undefine

全部标签

javascript - 渲染时获取 undefined 不是 React native 中的对象

我是React和Reactnative的新手,我正在尝试从API检索数据然后呈现它,但我似乎遇到问题。我可以从API获取数据,但是当我尝试渲染时,我遇到了各种各样的错误。基本上,我要做的就是渲染从API返回的照片。应该很简单吧?如果有人能指出我正确的方向,我将不胜感激。我收到如下错误:undefinedisnotanobject(evaluating'this.props.photos')inRenderPhotos_render我可能太早进入了ReactNative...请原谅我的知识匮乏!varAwesomeProject=React.createClass({getInitial

javascript - Chrome 控制台已经声明变量抛出 let 的 undefined reference 错误

最近我在chrome控制台遇到了这个奇怪的事情。在这里,我故意将未定义的事物分配给a以引发错误。leta=werwr//UncaughtReferenceError:werwrisnotdefined然后当我试图给a分配一些合法的东西时,发生了这样的事情:leta="legitstring"//UncaughtSyntaxError:Identifier'a'hasalreadybeendeclared所以我不能使用“let”,因为a已经声明了。因此,我尝试将其他内容重新分配给“已声明的”a="legitstring"//UncaughtReferenceError:aisnotdef

javascript - crockford 说 undefined 不能是属性值是什么意思?

在Javascriptthegoodparts一书中,Ch3onobjects的开篇,它指出:Anobjectisacontainerofproperties,whereapropertyhasanameandavalue.Apropertynamecanbeanystring,includingtheemptystring.ApropertyvaluecanbeanyJavascriptvalueexceptforundefined.注意:undefined在书中被突出显示,表示它是一个文字。然而,在实践中,我能够做到。vara={"name":undefined};我的理解有什么问

javascript - 如果数组是稀疏的,为什么 array.indexOf(undefined) 不起作用

我是JavaScript的新手,有一件事困扰着我。我有一个非常简单的代码:vara=[];a[1]=1;i=typeof(a[0]);index=a.indexOf(undefined);len=a.length;console.log(a);console.log("\n"+len);console.log("\n"+i);console.log("\n"+index);我的问题是:为什么indexOf返回-1,而不是0。我知道这个方法通过===进行比较,但我使用关键字undefined作为参数。如果我将方法参数更改为“未定义”,它也不起作用(但这对我来说很明显)。有人可以向我解释一

javascript - Three.js - 未捕获的类型错误 : undefined is not a function

我在使用Three.js时遇到了UncaughtTypeError:undefinedisnotafunction。在我创建THREE.PerspectiveCamera的行中显示错误。脚本是window.requestAnimFrame=(function(callback){returnwindow.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnim

javascript - jQuery 验证与 Summernote 编辑器错误 : Cannot read property 'replace' of undefined

我正在使用MVC5通过summernote编辑器构建一个表单。Razor代码:@Html.LabelFor(model=>model.Content,htmlAttributes:new{@class="control-label"})@Html.EditorFor(model=>model.Content,new{htmlAttributes=new{@class="form-controlpost-content"}})@Html.ValidationMessageFor(model=>model.Content,"",new{@class="text-danger"})JS:$(

javascript - 为什么 "undefined"结束 JavaScript 中的循环?

我无法理解这个for循环如何在JavaScript中终止:varfiles=["A","B"];for(vari=0,f;f=files[i];i++){console.log(f);}运行时,屏幕上显示A和B,但是为什么f=files[2]会结束循环呢?如果我在我的控制台中运行f=files[2],我会得到“未定义”的答案,那么这应该结束循环这一事实背后的基本原理是什么?奖励问题:为什么不把循环写成下面这样呢?for(vari=0;i这对我来说似乎更清晰且更易于维护,那么是否有某种原因可以使用第一段代码而不是第二段代码? 最佳答案

javascript - 火狐 "window.event is undefined"错误

我有这个脚本:functionpostBackByObject(e){varo=window.event.srcElement||e.target;if(o.tagName=="INPUT"&&o.type=="checkbox"){__doPostBack("","");}}我将此脚本与onclick="postBackByObject();"一起使用。但是在Firefox21中我得到这个错误:TypeError:window.eventisundefined我哪里错了? 最佳答案 那是因为它是。window.event适用于旧版

javascript - IE 抛出 JavaScript 错误 : The value of the property 'googleMapsQuery' is null or undefined, 不是函数对象(在其他浏览器中有效)

我在IE9中遇到JavaScript范围的真正问题。这是在我的文档正文中(是的,我知道脚本应该放在正确的HTML头部,但我以前从未让它破坏脚本)。该脚本在正文中,因为我不想弄乱仅与此页面相关的脚本的共享标题页:functiongoogleMapsQuery(accountNum){//functioncodeishere(omittedforbrevity)}这是在tdblock内部trblock内部tbodyblock内部tableblock内部body中的formblock:GoogleThis!我什至将脚本block移到表单上方,以防脚本函数声明的顺序相关(事实并非如此)。该脚本

javascript - 未捕获的类型错误 : Cannot read property 'offsetWidth' of undefined - chart. js

我有这个简单的html:和这个js:varctx=document.getElementById("myChart");varmyChart=newChart(ctx,{type:'bar',data:{labels:["Red","Blue","Yellow","Green","Purple","Orange"],datasets:[{label:'#ofVotes',data:[12,19,3,5,2,3],backgroundColor:['rgba(255,99,132,0.2)','rgba(54,162,235,0.2)','rgba(255,206,86,0.2)','r