This article describes the method of converting strings into character encoding lists in JavaScript. Share it for your reference. The details are as follows:
JavaScript converts strings into character encoding lists, such as foo to [112,111,111]
Method 1: JavaScript 1.6
Array.map('foo', function(x) { return String.charCodeAt(x) })// is [112,111,111]Method 2: JavaScript 1.7
[ String.charCodeAt(x) for each ( x in 'foo' ) ]// is [112,111,111]
I hope this article will be helpful to everyone's JavaScript programming.