switch(name){
???????????case ‘1‘:
???????????????age = 123;
???????????????break;
???????????case ‘2‘:
???????????????age = 456;
???????????????break;
???????????default :
???????????????age = 777;
???????}
???????
函数
???????function func(arg){
???????
???????????return arg+1
???????}
???????var result = func(1)
???????console.log(result);
???????
???????普通函数:
???????????function func(){
???????????????
???????????}
???????匿名函数:
???????????
???????????function func(arg){
???????????
???????????????return arg+1
???????????}
???????????
???????????setInterval("func()", 5000);
???????????
???????????setInterval(function(){
???????????????console.log(123);
???????????
???????????},5000)
???????????
???????自执行函数(创建函数并且自动执行):
???????????function func(arg){
???????????????console.log(arg);
???????????}
???????????// func(1)
???????????
???????????(function(arg){
???????????????console.log(arg);
???????????})(1)
序列化
???????JSON.stringify() ??将对象转换为字符串
???????JSON.parse() ??????将字符串转换为对象类型
???????
转义
???????客户端(cookie) ??=》 服务器端
???????将数据经过转义后,保存在cookie
js switch 函数类型 序列化 转义
原文地址:https://www.cnblogs.com/alex-hrg/p/9442026.html