let person:string ="李逍遥";
person="王二虎";
//常量
const tmp:string="你好";
//错误 // tmp="李四";
//let 和var 的区别
//1、let和var都是定义变量
//2、let必须先声明,再使用
//3、var是函数作用域,let是块作用域
//基本类型: bool string number
//数组
let a:number[]=[1,2];
//枚举
enum Color
{
red,
blue,
green
}
let color:Color=Color.blue;
//类型验证
let x:string=typeof person
console.log("类型 " +x);
//type
//运算符
//条件 if else switch
//循环 do while while for
//cocos 无function关键字
//实例化对象
let b=new xx();
b.say();
}
update(deltaTime: number) {
}
}
//类 字段函数
class xx
{
say()
{
}
}
CocosCreater学习(一)
猜你喜欢
转载自blog.csdn.net/dlyxaj/article/details/129787657
今日推荐
周排行