I have a list of ascii character codes returned as '104,101,108,108,111', and I am trying to translate those back to a string:
response = '104,101,108,108,111'
String.fromCharCode(response)
When I pass this to String.fromCharCode(response)
then I get ' '
as response, but when I pass input like below I am able to get proper response:
String.fromCharCode(104,101,108,108,111)
How can we pass number codes if we have a string of codes as response?
You need to turn your string into separate arguments: split by comma and spread:
let response = '104,101,108,108,111'; let result = String.fromCharCode(...response.split(",")); console.log(result);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.