What is an easy way to call Asc() and Chr() in JavaScript for Unicode values?

前端 未结 3 1446
小蘑菇
小蘑菇 2021-02-05 00:12

I am not that familiar with Javascript, and am looking for the function that returns the UNICODE value of a character, and given the UNICODE value, returns the string equivalent

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 00:47

    Example for generating alphabet array here :

    const arr = [];
    for(var i = 0; i< 20; i++) {
        arr.push( String.fromCharCode('A'.charCodeAt(0) + i) )
    }
    

提交回复
热议问题