Top 10 JavaScript errors
Top 10 JavaScript errors
javascript errors
https://rollbar.com/blog/tags/top-errors
https://rollbar.com/blog/top-10-javascript-errors/

TypeError
RangeError
ReferenceError
SyntaxError
InternalError
URIError
Warning
EvalError
JavaScript Errors
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
Uncaught TypeError: Cannot read property '...' of undefined
var foo;
foo.getName();
// Uncaught TypeError: Cannot read property 'getName' of undefined
foo.name;
// Uncaught TypeError: Cannot read property 'name' of undefined
Uncaught TypeError: Cannot read property 'length' of null
var obj = null;
obj.length;
// Uncaught TypeError: Cannot read property '...' of null
undefined == null;
//true
undefined === null;
//false
CORS script error
// .htaccess
// Access-Control-Allow-Origin
// crossorigin="anonymous"
Uncaught TypeError: ... is not a function
var foo;
this.foo();
// Uncaught TypeError: this.foo is not a function
foo();
// Uncaught TypeError: foo is not a function
this & context error
The reason is that the anonymous function being executed is in the context of the document, whereas
clearBoardis defined on the window.
function clearBoard(){
alert("Cleared");
}
document.addEventListener("click", function(){
console.log(`this`, this);
// this === #document
this.clearBoard();
});
window.addEventListener("click", function(){
console.log(`this`, this);
// this === Window
this.clearBoard();
});
bind
var that = this;
var self = this;
// save reference to 'this', while it's still this!
document.addEventListener("click", function(){
self.clearBoard();
// that.clearBoard();
});
/ /Alternatively, in the newer browsers, you can use the bind() method to pass the proper reference:
document.addEventListener("click", this.clearBoard.bind(this));
Uncaught RangeError
Number.toExponential(digits) accept digits from 0 to 100
Number.toFixed(digits) accept digits from 0 to 100
Number.toPrecision(digits) accepts digits from 1 to 100.
new Array(-1);
// Uncaught RangeError: Invalid array length
var num = 2;
num.toExponential(-2);
// Uncaught RangeError: toExponential() argument must be between 0 and 100 at Number.toExponential
// num.toFixed(101);
// Uncaught RangeError: toFixed() digits argument must be between 0 and 100 at Number.toFixed
num.toPrecision(0);
// Uncaught RangeError: toPrecision() argument must be between 1 and 100 at Number.toPrecision
Number
Number.MAX_VALUE;
// 1.7976931348623157e+308
Number.MAX_VALUE + Number.MAX_VALUE;
// Infinity
Number.parseFloat(Infinity);
// Infinity
Number.MIN_VALUE;
// 5e-324
Number.MAX_SAFE_INTEGER;
// 9007199254740991
Number.MIN_SAFE_INTEGER;
// -9007199254740991
function local params empty bug
function 形参,实参
var testArray= ["Test"];
function testFunction(testArray) {
for (var i = 0; i < testArray.length; i++) {
console.log(testArray[i]);
}
}
testFunction();

Uncaught TypeError: Cannot set property '...' of undefined
var foo;
foo.name = foo;
// Uncaught TypeError: Cannot set property 'name' of undefined
Uncaught ReferenceError: ... is not defined
xyz;
// Uncaught ReferenceError: xyz is not defined
Errors on the world’s top 100 websites and how to avoid them
https://rollbar.com/blog/top-100-websites-errors/

HTTP error
TypeScript
- JavaScript that scales.
- TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
- Any browser. Any host. Any OS. Open source.
https://www.typescriptlang.org/
refs
https://rollbar.com/error-tracking/javascript/
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
Top 10 JavaScript errors的更多相关文章
- The Top 10 Javascript MVC Frameworks Reviewed
Over the last several months I have been in a constant search for the perfect javascript MVC framewo ...
- Top 10 JavaScript编辑器,你在用哪个?
对于JavaScript程序员来说,目前有很多很棒的工具可供选择.文本将会讨论10个优秀的支持JavaScript,HTML5和CSS开发,并且可以使用Markdown进行文档编写的文本编辑器.为什么 ...
- GitHub上最流行的Top 10 JavaScript项目
统计出Github中所有项目的数量,几乎是不可能的,而明确指出哪些是最优秀的项目就更不可能了.如果说到JavaScript,曾经极富创新的项目(很可能)在一两个月后就会变得过时.落后.以防被淹没在大量 ...
- Top 10 Javascript MVC 框架
在网上偶然看到了,几种MVC框架各有优缺点,但Backbone和Ember的呼声相对更高-大家参考一下哈- http://codebrief.com/2012/01/the-top-10-javasc ...
- OWASP Top 10 – 2013, 最新十大安全隐患(ASP.NET解决方法)
OWASP(开放Web软体安全项目- Open Web Application Security Project)是一个开放社群.非营利性组织,目前全球有130个分会近万名会员,其主要目标是研议协助解 ...
- [转]Top 10 DTrace scripts for Mac OS X
org link: http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scripts-for-mac-os-x/ Top 10 DTra ...
- ASP.NET Core中的OWASP Top 10 十大风险-失效的访问控制与Session管理
不定时更新翻译系列,此系列更新毫无时间规律,文笔菜翻译菜求各位看官老爷们轻喷,如觉得我翻译有问题请挪步原博客地址 本博文翻译自: https://dotnetcoretutorials.com/201 ...
- OWASP TOP 10 2017中文译文
说明:owasp top 10其实有中文官方版本:本文是按着英文版进行翻译而成. 官方中文版:http://www.owasp.org.cn/owasp-project/OWASPTop102017v ...
- SQL Server: Top 10 Secrets of a SQL Server Expert
转载自:http://technet.microsoft.com/en-us/magazine/gg299551.aspx Many companies have downsized their IT ...
随机推荐
- php artisan db:seed 报错
在laravel 5中执行,要执行数据填充时报如下错误 php artisan db:seed 错误: [ReflectionException] Cla ...
- Python_ 1生成器(上)初识生成器
引言:列表生成式 现在有个需求,给定列表[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],现在要求你把列表里的每个值加1,你怎么实现?你可能会想到2种方式 1 >>> a ...
- Hash Map集合和Hash Set集合
HashMap集合的使用 1.1.每个集合对象的创建(new) 1.2.从集合中添加元素 1.3.从集合中取出某个元素 1.4.遍历集合 public class HashMapTest { publ ...
- HaspMap源码分析(JDK 1.8)
底层结构分析 上面这两张图分别画出了JDK 1.7.1.8底层数据结构,在JDK 1.7.1.8中都使用 了散列算法,但是在JDK 1.8中引入了红黑树,在链表的长度大于等于8并且hash桶的长度大于 ...
- Mysql数据库版本高低引起的group by问题
低版本的Mysql,group by限制性比较小,在进行group by时,select的对象可包含多个,但是换成高版本5.6以上好像,使用group by 以后,select的对象必须也已经被聚合, ...
- 最新Ceph L版与openstack Pike对接
安装Ceph luminous 实验环境 三台服务器,每台服务器都有4块硬盘,每台服务器都将自己的第一块硬盘作为系统盘,剩下的做ceph 一.在所有服务器上操作 #使用阿里源 yum inst ...
- C++类基本--随笔二
1 #include <iostream> 2 #include <string.h> 3 using namespace std; 4 5 class Internet 6 ...
- RIDE对应驱动下载
https://blog.csdn.net/apollolkj/article/details/75408237
- DedeCMS程序使用拼音首字母做栏目名称的方法
Dedecms织梦程序默认使用拼音为保存目录的时候使用的是中文全拼,当遇到栏目名称比较长的时候目录名称看起来有点冗长,这时候大多数站长喜欢使用拼音首字母作为栏目的保存目录,那么就需要修改 dede/c ...
- Java基本类型的内存分配在栈还是堆
我们都知道在Java里面new出来的对象都是在堆上分配空间存储的,但是针对基本类型却有所区别,基本类型可以分配在栈上,也可以分配在堆上,这是为什么? 在这之前,我们先看下Java的基本类型8种分别是: ...