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 ...
随机推荐
- vue-cli快速创建项目,交互式
vue脚手架用于快速构建vue项目基本架构 下面开始安装vue-cli npm install -g @vue/cli # OR yarn global add @vue/cli以上两句命令都可以安装 ...
- Redis 学习笔记系列文章之 Redis 的安装与配置 (一)
1. 介绍 Redis is an open source (BSD licensed), in-memory data structure store, used as database, cach ...
- SpringMVC听课笔记(十四:异常处理)
1. SpringMVC通过HandlerExceptionResolver处理程序的异常,包括Handler映射,数据绑定以及目标方法执行时发生的异常 2.SpringMVC提供的HandlerEx ...
- 小白搭建WAMP详细教程---php安装与设置
一.php官网下载php压缩包 到php官网http://www.php.net 下载,有很多版本,我们这里选择7.2.25,具体步骤如下: 二.php的安装 下载后得到如下的压缩包,将压缩包解压到您 ...
- HttpRunner(1)自我介绍
前言 首先,我们无论学习哪个框架,都要带着问题,带着思考去学习 思考1:HttpRunner是什么? 思考2:HttpRunner的设计模式是什么? 思考3:为什么我们要学习HttpRunner?他的 ...
- 基于C#/Winform实现的Win8MetroLoading动画
非常喜欢Metro风格的界面,所以想模仿一下一些UI效果的实现,网上找到了很多,但都是CSS3,WPF等实现,对于XAML和CSS3一窍不通,无奈下只有自己开始写. 下面是源码: 1 using Sy ...
- mysql创建和使用数据库
mysql连接和断开 mysql -h host -u user -p******** /*建议不要在命令行中输入密码,因为这样做会使其暴露给在您的计算机上登录的其他用户窥探*/ mysql -u u ...
- 阅读笔记:Item-based Collaborative Filtering Recommendation Algorithms
概要: 推荐系统通过信息获取技术解决在线的个人的消息.产品或者服务的推荐问题.这些系统,特别是基于k临近协同过滤算法,在网络上取得了广泛的成功.可用信息和访问人数的巨大增加成了推荐系统一个难题.基于商 ...
- Educational Codeforces Round 90 (Rated for Div. 2) B. 01 Game(字符串博弈)
题目链接:https://codeforces.com/contest/1373/problem/B 题意 给出一个二进制串 $s$,Alica 和 Bob 每次可以选择移去 $s$ 中的一个 $10 ...
- Codeforces 1355 D. Game With Array
传送门:D - Game With Array 题意:让你构造一个长度为n的序列,并且n个数的和为S,问能不能找到一个1~n的数k,使得数组里找不出一个子序列的和为k或者n-k: 题解:最简单的想法肯 ...