<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>自定义错误throw</title>
<!--
throw a;
解读:
抛出错误,并自定义错误消息a,a就是发生错误后的消息提示
可使用catch(b)捕获错误信息b,b就是自定义错误的名字,也可以称为容纳错误的对象 切记:当生成错误时,JavaScript实际上会创建带有两个属性的Error对象:name和message。
-->
</head>
<body>
<script>
var a=1;
try{
throw "我是错误提示";//自定义error massage
}
catch (b){//catch()捕获error name=b
console.log(b);//b容纳了throw定义的error massage
}
</script>
</body>
</html>

最新文章

  1. [BZOJ4198][Noi2015]荷马史诗
  2. js实现快速排序
  3. Warning: Null value is eliminated by an aggregate or other SET operation.
  4. lodash常用方法1--查询
  5. android开发 两张bitmap图片合成一张图片
  6. PAT 1017
  7. System Operations on AWS - Lab 2 - Configuring VPC
  8. PL/SQL 包头和包体
  9. DIV+CSS 让同一行的图片和文字对齐
  10. Linux(centos5.0+)unison+inotify-tools触发式双向自动同步
  11. netty&mdash;&mdash;私有协议栈开发案例
  12. sed 实践案例 (不定期更新)
  13. 三十分钟学完Vue
  14. CF 634A Island Puzzle
  15. C#-----类FileStream的使用
  16. centos7 pgpool+postgresql
  17. JS删除String里某个字符的方法
  18. [转]一个CMake编译问题的解决过程
  19. 基于asp.net mvc的近乎产品开发培训课程(第三讲)
  20. jenkins 基本插件

热门文章

  1. 缓存利器之Ehcache
  2. 【坑】Mybatis 多次逆向工程生成mapper文件
  3. 安卓版 WPS 使用电脑字体、安卓版 WPS 添加字体、安卓 WPS 无法显示文档真实字体(24)
  4. LC 21. Merge Two Sorted Lists
  5. sql注入测试(3)---现象分析
  6. python运行报错:cannot import name &#39;InteractiveConsole&#39;
  7. 编程模型&amp;编程思想
  8. C++ raw string literal
  9. html5+css3 快速学习
  10. hive 存储格式对比