变量声明

  • 变量命名:数字、字母、下划线,不能使用关键字、数字不能开头
  • 声明规则let 变量名:类型 = 默认值
let str : string = "Hi,Jarlen"
  • 赋值
str = "Hello,World"

常量声明

  • 声明规则:const 常量名:类型 = 值
const PI:string="3.1415"
  • 常量不能更改