1.字符转ASCII

使用字符串自带的.charCodeAt()方法

  1. str = 'hello'
  2. a = str.charCodeAt()
  3. console.log(a) //

2.ASCII转字符

使用 String类型内置的方法 String.fromCharCode()

  1. a = 10
  2. str = String.fromCharCode()
  3. console.log(str) //