PHP全栈学习笔记33

javascript能做什么?
语句与注解,标识符,字面量,变量命名规范
JavaScript中的数据类型,其它类型如何转为数据型,操作符

字符方法,数组方法,函数与对象,函数表达式,变量作用域,对象

JavaScript条件判断,switch结构,while,do-while循环,for循环,for-in循环

DOM树,onload与onclick事件,节点属性,关系,增删改查,子节点判断与操作

事件,给对象绑定事件的三种方法,事件冒泡与拦截

js语句写在html文档中

标识符,变量,字面量

标识符必须以字母,下划线,$开头

标识符不能以数字,特殊符号开头,不能使用保留字

变量,使用var关键字创建,命名要符合标识符规范,按名称调用,区分大小写

JavaScript数据类型:

undefined,null,number,Boolean,String,Object

typeof操作符

null 本身就是一个对象
var data = null
undefined
type of data
"object"
undefined == null
true
var message = ' '
undefined

message == false
true
var message = 'jscsshtml'
undefined

message
'jscsshtml'

message.length
9

var num = 12
undefined

var numString = num.toString()
undefined

numString
"12"

typeof numString
"string"
var obj = new Object()
undefined

typeof obj
"object"

obj.url = 'dashu'
'dashu'

obj.url
'dashu'
obj.sayhello = function() {console.log('dashu')}
function() {console.log('dashu')}

obj.sayhello()
dashu

Number()
其他类型转数值类型

parseInt()
将数字开头的字符串转为整数

parseFloat()
将数字开头的字符串转为小数

Number(' ');
0

Number('123')
123

Number(true)
1

Number('da')
NaN

操作符
算术操作符,字符操作符,布尔操作符
赋值操作符,一元操作符,比较操作符

字符串.方法名

[外链图片转存失败(img-10qh1R2G-1564278128080)(https://upload-images.jianshu.io/upload_images/11158618-5f0a3c332df01380.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)]

JavaScript中的数组方法

[外链图片转存失败(img-Z5kor7I1-1564278128083)(https://upload-images.jianshu.io/upload_images/11158618-5bbdf9aa0dc28d43.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)]

[外链图片转存失败(img-GcROZcuT-1564278128085)(https://upload-images.jianshu.io/upload_images/11158618-635fe7722d858a8a.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)]

[外链图片转存失败(img-lp0qu5tU-1564278128090)(https://upload-images.jianshu.io/upload_images/11158618-5c5096e2a9d67bcf.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)]

function 函数名(参数列表){
 函数体由一条或多条语句组成;
}

变量作用域

函数内部创建的变量是局部变量,只能在函数内部使用
在函数外部创建的是全局变量,当前脚本任何地方都能用


请点赞!因为你的鼓励是我写作的最大动力!

[外链图片转存失败(img-9SEoXvIP-1564278128091)(//upload-images.jianshu.io/upload_images/11158618-f0c11041a76563e7?imageMogr2/auto-orient/strip|imageView2/2/w/1240 “喜欢我就关注我”)]

吹逼交流群:711613774

[外链图片转存失败(img-1PjPMokB-1564278128097)(//upload-images.jianshu.io/upload_images/11158618-d9d64fa290371ea5.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)]

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!
原文地址:https://www.cnblogs.com/dashucoding/p/11932337.html