Js的三个组成部分 核心ECMA标准 文档对象模型DOM 浏览器对象模型BOM
在js控制台经常会看到的几种错误
Uncaught SyntaxError: Invalid or unexpected token 语法错误 无效或意外的标记
Uncaught ReferenceError: sdasdad is not defined 引用错误 未被定义
Uncaught TypeError: console.lowg is not a function 类型错误,不是一个正确的函数
声明一个变量
以 var 声明一个变量
变量的命名规范 必须以字母 下划线 $符号开头 以数字或其他字符开头的命名是错误的
最好在一个语句结束时加上" ; "
输出一个变量
var a="hello world";
document.write("hello world") 网站输出
console.log("hello world") 控制台输出
alert("hello world") 网站弹出
js的数据类型
string 字符串类型
bumber 数字类型
boolean 布尔值,输出结果为true,false
null 空对象
objec