草庐IT

fcatch-undefined-behavior

全部标签

javascript - 未捕获的类型错误 : Cannot read property 'then' of undefined using Sweet Alert

我正在使用SweetAlert2我收到以下错误UncaughtTypeError:Cannotreadproperty'then'ofundefined当我使用与SweetAlert页面中建议的完全相同的代码时。swal({title:'Areyousure?',text:"Youwon'tbeabletorevertthis!",type:'warning',showCancelButton:true,confirmButtonColor:'#3085d6',cancelButtonColor:'#d33',confirmButtonText:'Yes,deleteit!',canc

javascript - 对所有包含 "undefined” 的不存在页面的请求

自2014年10月20日起,我们的日志中出现了一些奇怪的请求。它们已经增加到每天大约几十个,所以虽然不是什么大问题,但找出原因仍然很有趣。早期的:REQUEST[/en/undefinedsf_main.jsp?clientVersion=null&dlsource=null&CTID=null&userId=userIdFail&statsReporter=false]REFERER[http://colnect.com/en/coins]REQUEST[/fr/undefined/GoogleExtension/deals.html?url=http://colnect.com&s

javascript - '类型错误 : undefined is not a function' when jumping 'tween modules

我在Node中不断遇到这个问题,每当我相互调用函数时,我的应用程序就会崩溃。我已经做了这个最小的工作示例(按照它的方式工作给了我错误):启动模块varmodule2=require('./module2');vardata='data';module2.doStuff(data);模块2varmodule3=require('./module3');functiondoStuff(data){//Stuffhappensto'data'module3.takeStuff(data);}functiondoSomethingElse(data){console.log(data);}mo

javascript - 为什么 typeof let === 'undefined' ?

为什么typeoflet返回'undefined'而不是抛出SyntaxError?console.log(typeoflet);一元typeof运算符需要一个表达式。我是否遗漏了有关let语句的内容? 最佳答案 typeof运算符将let视为未声明的变量。查看更多信息MDNdocs.用一个未声明的变量看这个。console.log(typeofelefromstack)在严格模式下,会抛出一个错误。'usestrict'console.log(typeoflet); 关于javascr

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

我有一个插件可以访问许多元素的length属性。但是,javascript控制台指向jquery.min.js的第12行。我如何回溯以找到我的插件中有问题的行? 最佳答案 如果您使用缩小的脚本,任何调试器(例如完全最好的Firebug)都会向您显示相同的问题行,并且此信息毫无用处(缩小的脚本难以阅读和理解,并且它们写在一行中)。解决此类问题的几种方法:正如我之前所说:为了开发而不是缩小脚本,调试器会向您显示有意义的行,如果您幸运的话,您可以找到非常有用的开发人员评论。如果找不到完整版本的脚本,请使用像这样的unminifier:ht

javascript - 为什么 Angular 5 Transition 抛出 AppComponent.html :2 ERROR TypeError: Cannot read property 'forEach' of undefined

为什么Angular5会抛出这个错误?AppComponent.html:2ERRORTypeError:Cannotreadproperty'forEach'ofundefined我正在研究Angular动画的概念验证,我直接使用网站上的代码。我的组件如下所示:import{Component,OnInit}from'@angular/core';import{trigger,state,style,transition,animate,keyframes}from'@angular/animations';@Component({selector:'app-obj-list',te

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

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭4年前。Improvethisquestion升级到16.x后出现以下错误UncaughtTypeError:Cannotreadproperty'injection'ofundefinedatinjectTapEventPlugin(injectTapEventPlugin.js:23)ateva

javascript - Javascript 库中名为 undefined 的变量

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicates:HowdoesthisJavaScript/JQuerySyntaxwork:(function(window,undefined){})(window)?Whatadvantagesdoesusing(function(window,document,undefined){…})(window,document)confer?我看到很多javascript库创建了一个名为“undefined”的变量,我无法弄清楚它的用途,下面是从jQuery库复制的行*Date:WedFeb2313:55:292011-

javascript - 无论如何在 Visual Studio 智能感知中定义一个 undefined object ?

假设我在AngularJS中有一个Controller:myApp.controller('SearchController',function($scope,UserService){//forintellisense,UserServiceisundefinedherevaruser=UserService.getUsers().then(function(data){//yadayada},function(err){//yadayada});});但是,在我的intellisense文件中,我可以动态注入(inject)UserService来获取它的功能,如下所示:intel

javascript - 在 JavaScript 中检查 null/undefined

这个代码可以吗if(typeoffoo!="undefined"&&foo!==null){}可以安全地重构到这段代码中吗?if(foo!=null){}这是一回事吗?(如果不是,它有什么不同?) 最佳答案 不是真的。你会得到一个ReferenceError如果foo尚未声明,则在第二个示例中出现异常。另一方面,您可以使用typeof安全地检查未定义的未声明变量运营商。 关于javascript-在JavaScript中检查null/undefined,我们在StackOverflow上