草庐IT

something_undefined

全部标签

javascript - 咕噜 requirejs 'define is undefined'

我正在尝试使用GruntJS优化RequireJS,使用grunt-contrib-requirejs插件。问题是我的代码在优化之前工作正常,然后在优化之后,在控制台上显示UncaughtReferenceError:defineisnotdefined。这是Gruntfile.jsmodule.exports=function(grunt){grunt.loadNpmTasks('grunt-contrib-requirejs');grunt.initConfig({requirejs:{compile:{options:{name:'main',baseUrl:".",mainCo

javascript - .map() undefined 不是 React.js 中的函数

是的,我可能在这里遗漏了明显的问题,但我收到“未捕获的类型错误:未定义不是函数”我似乎是.map()这就是问题所在,但我不明白为什么。varidealist=React.createClass({loadCommentsFromServer:function(){$.ajax({url:this.props.url,dataType:'json',success:function(data){this.setState({data:data});}.bind(this)});},handleButtonClick:function(input){//dostuff//},getInit

javascript - 为什么 JSLint 告诉我使用 "=== undefined"而不是 "typeof ... === ' undefined'”?

我编写了以下代码:showTitles=(typeofshowTitles!=='undefined')?showTitles:'Y';showSelectGroup=(typeofshowSelectGroup!=='undefined')?showSelectGroup:'Y';但是JSLint说:Warning3JSLint:Unexpected'typeof'.Use'==='tocomparedirectlywithundefined.我应该如何更改我的代码? 最佳答案 可能是通过使用showTitles=(showTit

javascript - 未捕获的类型错误 : cannot read property 'replace' of undefined In Grid

我是KendoGrid和KendoUI的新手。我的问题是如何解决此错误UncaughtTypeError:Cannotreadproperty'replace'ofundefined这是我在KendoGrid上的代码$("#Grid").kendoGrid({scrollable:false,sortable:true,pageable:{refresh:true,pageSizes:true},dataSource:{transport:{read:{url:'/Info/InfoList?search='+search,dataType:"json",type:"POST"}},p

javascript - 没有 JSX 的 React.js - "Warning: Something is calling a React component directly. Use a factory or JSX instead"

我试图在没有JSX的情况下使用React.js组件并收到这样的警告:警告:某些东西正在直接调用React组件。改用工厂或JSX。请参阅:http://fb.me/react-legacyfactory我访问过链接,但建议的createFactory解决方案对我没有帮助:/app.jsvarReact=require('react/addons');varTagsInput=React.createFactory(require('./tagsinput'));//noluckvarTagsComponent=React.createClass({displayName:"TagsCom

javascript - 为什么 null==undefined 在 javascript 中是真的

如果我们alert(null==undefined)它输出为true。这是什么逻辑原因。这是用javascript硬编码的东西还是对此有解释。 最佳答案 语言规范explicitlysays:Ifxisnullandyisundefined,returntrue我不知道有任何语言设计过程的记录可以解释该决定的原因,但是==有处理不同类型的规则,“null”和“undefined”是两者都表示“无”,因此让它们相等在直觉上是有意义的。(如果您不想要类型调整,请改用===)。 关于javas

javascript - 递归函数的返回值为 'undefined'

每当我执行此代码段时,返回前的console.log都会返回值23的20倍的数组。然而console.log(Check(users,0,20));仅返回“未定义”。我做错了什么?varusers=[23,23,23,23,23,23,23,23,23,23];console.log(Check(users,0,20));functionCheck(ids,counter,limit){ids.push(23);//Recursionif(counter+1 最佳答案 您忘记从进入递归的点返回结果。varusers=[23,23,2

javascript - 为什么 "3 [1, 2];"在 JavaScript 中返回 undefined?

我查看了GMail执行的一些AJAX调用,我注意到有时调用的返回值以数字开头。示例:(注意第一行后没有分号)3[1,2];如果我将其输入JavaScript控制台,我会返回undefined。但是,如果第二个参数是数字或字符串,我会返回第二个参数。示例:34返回4.我的猜测是他们这样做是为了阻止jsonp类型的攻击,但是,有谁知道正在进行的基础评估是什么?在第二种情况下,我相信在第一行之后“插入”了一个分号,这将使返回4有意义。但是,我想不出第一个表达式返回未定义的原因。 最佳答案 这是因为ASI(自动分号插入)的工作原理。第一条语

javascript - 为什么 'NaN' 和 'Undefined' 不是 JavaScript 中的保留关键字?

我们可以做到:NaN='foo'还有undefined='foo'为什么它们不是保留关键字?我认为应该实现它,以确保当我们正在寻找一个number时,它是一个number:)如果我们应该使用IsNaN()或typeof,为什么需要NaN或undefined? 最佳答案 我不能告诉你为什么,但是undefined和NaN实际上是全局对象的属性:15.1.1ValuePropertiesoftheGlobalObject15.1.1.1NaNThevalueofNaNisNaN(see8.5).Thispropertyhastheatt

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

当我尝试从AJAX调用中获取数据并在单击提交按钮时将其插入另一个函数时,如何避免出现以下错误?ajax函数中的console.log调用显示数据已被抓取,我希望然后存储在json_data中。当时的目的是使用此数据来更改通过HTML表单提交的字符串。然后在“点击”函数的行返回错误:console.log(json_data.length);TestForm#results_box{border:red5pxsolid;}#place{border:#cccccc1pxsolid;}$(document).ready(function(){varjson_source="https://