var obj ={'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}
VM3614:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:47
(anonymous) @ VM3614:1
var obj
undefined
obj ={'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}
VM3633:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:43
(anonymous) @ VM3633:1
obj = "{'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}"
"{'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}"
alert(obj)
undefined
var oo =eval("("+obj+")")
VM3699:1 Uncaught ReferenceError: False is not defined
at eval (eval at <anonymous> ((index):1), <anonymous>:1:39)
at <anonymous>:1:9
(anonymous) @ VM3699:1
(anonymous) @ VM3698:1
var oo =eval(obj)
VM3724:1 Uncaught SyntaxError: Unexpected token :
at <anonymous>:1:14
(anonymous) @ VM3723:1
obj
"{'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}"
typeof obj
"string"
obj ={'id': 16, 'name': '管理员', 'delflag': False, 'grade': 1000000.0}
VM3755:1 Uncaught ReferenceError: False is not defined
at <anonymous>:1:43
(anonymous) @ VM3755:1
obj ={'id': 16, 'name': '管理员', 'grade': 1000000.0}
{id: 16, name: "管理员", grade: 1000000}
alert(obj)
undefined
var test =eval("("+obj+")")
VM3847:1 Uncaught SyntaxError: Unexpected identifier
at <anonymous>:1:23
(anonymous) @ VM3846:1
var test =eval("("+"obj"+")")
undefined
typeof test
"object"
alert(test)
undefined

原因是:字典里存储了一个False的变量,js无法识别,SO  报错,

更重要的是,因为不是正规的json格式,所以会报错,正规的 key 是必须要有双引号的。(即使是单引号也不行。)

错误代码:

var res = "[{id:1,name:'liming'},{id:2,name:'xiaobai'}]";
var objRes = JSON.parse(res);
console.log(objRes)
1
2
3
正确代码:

var res = '[{"id":1,"name":"liming"},{"id":2,"name":"xiaobai"}]';
var objRes = JSON.parse(res);
console.log(objRes)

关于 eval 的报错 Uncaught ReferenceError: False is not defined的更多相关文章

  1. jquery报错Uncaught ReferenceError: $ is not defined

  2. clipboard复制剪贴板功能,以及用requirejs时报错---Uncaught ReferenceError: Clipboard is not defined

    zeroclipboard是走的flash插件,手机浏览器是不支持的,所以不得不舍弃之,用clipboard,clipboard不需要flash就可以完成复制剪切等功能,而且可以兼容pc,移动端,下面 ...

  3. ext.net在使用水晶报表时页面无数据显示,并报错误Uncaught ReferenceError: bobj is not defined.

    一.错误描述 在公司做项目的时候,有时会需要用到水晶报表显示数据,水晶报表在ASP.NET中使用时没有问题,winform项目开发也没有问题,但是在ext.net开发使用时却报错了,错误:Uncaug ...

  4. gulp 打包报错:ReferenceError: internalBinding is not defined

    > gulp build internal/util/inspect.js:31 const types = internalBinding('types'); ^ ReferenceError ...

  5. bootstrap4popper.js报错Uncaught ReferenceError

    这是因为bootstrap4需要umd版的popper.js <script src="https://cdn.bootcss.com/popper.js/1.15.0/umd/pop ...

  6. jquery报错:“ReferenceError: jQuery is not defined”

    这明显是没有引到jquery,原因就是jquery没有放在最前面,jquery应该最先引入.

  7. vue项目中引入mui.poppicker.js文件时报错“Uncaught ReferenceError: mui is not defined”

    解决:在mui.js的源文件后最后加上 window.mui = mui;

  8. JS报错修改日记(1):Uncaught ReferenceError: showQRcode is not defined

    为了加一个查看二维码的功能,如: //页面内按钮 <a class="manipulate-btn" href="#" onclick="sho ...

  9. 网页视频不能自动播放?HTML5 video报错Uncaught (in promise) DOMException解决方法

    话说发哥四年前写了一个网页,如上图效果,实际网址http://pano.z01.com ,话说做好时是正常的,突然某一天,客户说你这个网站动画不见了,这是什么原因? 结果检查脚本一切正常. 其实也不是 ...

随机推荐

  1. 【codeforces 24D】损坏的机器人

    题目大意:有一只坏了的机器人站在一个n∗m的网格里,初始位置在(x,y).现在每个单位时间内它会随机选左右下三个方向走,如果它随机的方向会走出网格就不会往这个方向走.当然这个机器人也可能原地停留一个单 ...

  2. UIDevice currentDevice model possible values

    NOTE: The below code may not contain all device's string, I'm with other guys are maintaining the sa ...

  3. 【PaddlePaddle系列】报错解决方法合集 (不定时更新)

    1.PaddlePaddle使用CPU时正常运行,但是使用GPU时却报出一堆错误信息,节选如下: paddle.fluid.core.EnforceNotMet: enforce allocating ...

  4. Numpy 数组和dtype的一个使用误区

    首先自定义三种类型(如下代码1-3行),第一行使用scalar type,第2,3行使用Structured type. 提出问题:第5,7行同为创建数组,为什么第5行能work,而第7行会raise ...

  5. (转)MySQL 线程池内幕

    原文:http://blog.jobbole.com/109695/ http://mysqllover.com/?p=826 http://blog.csdn.net/hsuxu/article/d ...

  6. windows下如何下载并安装Python

    1.打开Python官网,点download中的windows(或者打开网址https://www.python.org/downloads/windows/) 2.下载exe后缀的可执行文件,根据自 ...

  7. spark 中如何查看单个RDD分区的内容(创建分区,查看分区数)

    spark 创建分区 val scores = Array(("Fred", 88), ("Fred", 95), ("Fred", 91) ...

  8. 【树】Construct Binary Tree from Preorder and Inorder Traversal

    题目: Given preorder and inorder traversal of a tree, construct the binary tree. 思路: 线序序列的第一个元素就是树根,然后 ...

  9. asp.net四中绑定方式

    ASP.NET Eval四种绑定方式: 1.1.x中的数据绑定语法 <asp:Literal id="litEval2" runat="server" T ...

  10. 15-hadoop-eclipse插件的安装

    好久没更新了, 也好久没学了, 今天换了个eclipse版本, 安装插件坑了一会, 果然好记性不如烂笔头, 记下来吧 编译安装或者直接安装都可以, 先说下编译安装吧 1, 编译安装, 是使用的ant, ...