草庐IT

UNDEFINED

全部标签

javascript - app.configure(function){} typeerror undefined is not a function

我正在使用socket.io和angularjs创建一个聊天应用程序,当我使用cmd运行app.js文件时,我收到一条错误消息“app.configure(function){}typeerrorundefinedisnotafunction”可能是什么问题?我的代码是这样的:varhttp=require('http');varexpress=require('express'),routes=require('./routes'),socket=require('./routes/socket.js');app=module.exports.app=express();varser

javascript - 使用 map 时 react 'cannot read property of undefined'

我正在从teamtreehouse.com制作一个非常基本的React应用程序,并且我经常遇到"TypeError:Cannotreadproperty'onPlayerScoreChange'ofundefined"即使我正确地绑定(bind)了我的函数(我认为)'onPlayerScoreChange'是Grandparent组件中的一个方法,当用户点击“+”或“-”按钮更改玩家得分时执行。如果有人能解释出什么问题,那将非常有帮助,因为我想我在曾祖parent的构造函数中设置了this.onPlayerScoreChange=this.onPlayerScoreChange.bin

javascript - IE 中未定义的 outerHTML

我的代码从Ajax调用中获取JSON,其中包含XML,并通过它读取一些信息。虽然XML的解析在Chrome中运行良好,但在IE中却不行,因为在IE中outerHTML返回undefined。我浏览了几篇文章并尝试了几种可能的解决方案,但都没有成功。JavaScript代码是:$.ajax({url:'getJSONwithXML.do',type:'POST',data:'',dataType:'json',cache:false}).done(function(data){varjsonResp=JSON.parse(data.data.respuesta);varparser=ne

javascript - 来自 prototype.js 第 3877 行的 "undefined handler"

一个非常小众的问题:我有时(30%的时间)在prototype.js库(来自google的版本1.6.0.2:http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js)的第3877行收到“未定义的处理程序”javascript错误。现在在这个页面上我有一个谷歌地图,我使用原型(prototype)窗口库。问题出现在IE7和FF3中。这是FireBug提供的信息:handlerisundefined?inprototype.js@3871()prototype.js(line3877)handler.call(

javascript - Angularjs/ ionic 类型错误 : Cannot read property 'then' of undefined

代码:js:angular.module('starter.services',['ngResource']).factory('GetMainMenu',['$http','$q','$cacheFactory',function($http,$q,$cacheFactory){varmethodStr='JSONP';varurlStr='http://localhost/bd/wp-admin/admin-ajax.php';varptStr={action:'bd_get_main_menus',callback:'JSON_CALLBACK'};return{getMainM

javascript - Typescript - null 和 undefined 之间有什么区别?

这个问题在这里已经有了答案:WhatisthedifferencebetweennullandundefinedinJavaScript?(38个答案)关闭5年前。我想知道typescript中null和undefined的区别。我知道在javascript中可以同时使用它们来检查变量是否没有值。但是在typescript中,我想知道确切的区别以及何时最好使用它们中的每一个。谢谢。

javascript - 是否可以覆盖javascript中的未定义?

喜欢functionmyFunction(){varundefined="abc";}如果可能,那么如何限制不允许这样做? 最佳答案 Isitpossibletooverwritetheundefinedinjavascript?如果“未定义”是指全局undefined变量,则不是。从EcmaScript5开始,它是specifiedasnon-writable.但是,旧版浏览器不遵守该规范,因此它在旧版引擎中是可覆盖的。你不能真正阻止它们,但是alwaysresetitbyundefined=void0;.如果您仍然担心并想知道如

javascript - 重置 Javascript 对象中所有值的最佳方法

我的javascript对象看起来像这样:$scope.display={current:{key1:'value1',key2:['a','b'],key3:'value2'}}在我的代码中发生某些事件时,我想将这些值重置为未定义,如下所示:$scope.display={current:{key1:undefined,key2:[],key3:undefined}}我使用像lodash这样的库,但是我没有看到任何可以执行此操作的函数。我知道如何手动执行此操作,但我想知道是否有执行此任务的“最佳实践”方法。 最佳答案 我会创建一个

javascript - 有没有办法处理在 JavaScript 中调用的未定义函数?

如果我有如下函数:functioncatchUndefinedFunctionCall(name,arguments){alert(name+'isnotdefined');}然后我做了一些傻事,比如foo('bar');当foo未定义时,有什么方法可以调用我的catch函数,名称为“foo”,参数为包含“bar”的数组? 最佳答案 无论如何,MozillaJavascript1.5中都有(它是非标准的)。检查一下:varmyObj={foo:function(){alert('foo!');},__noSuchMethod__:f

javascript - 为什么要重用 `undefined` ?

这个问题在这里已经有了答案:HowdoesthisJavaScript/jQuerysyntaxwork:(function(window,undefined){})(window)?(5个答案)Nextparameteris'undefined'injQuery,why?[duplicate](3个答案)关闭9年前。在JohnResig'sslideshow在谈到他如何构建jQuery1.4时,他提到了一点,他在jQuery闭包中添加了一个undefined变量,因为“我们可以重用(变量)”。undefined不是普通变量:>varundefined=4undefined>undef