The last example will show that we can use this method just like fromCharCode() method, but at the same time, it can do much much more thanks to the fact that it can process code points as well. But that’s the direction Javascript is heading and we can either accept it or leave. True is interpreted as one.Īll in all, the fromCharCode() method was much more forgiving in this department. The same happens with boolean value false. Strangely enough, the null constant is accepted as zero. try Īlso a string, an object and an array will cause RangeError to be thrown. non-integer numbers (floats, scientific notations, …).any string value that is not single white space character.One of the news in this method is RangeError, which is thrown if the argument is not 0 or a positive integer number. Any number format is fine, but mostly you will want to use decimal or hexadecimal format for the convenience. So as you can see, I can create single character or multiple characters at once using their unicode code point values. Since this is the newer and improved version of the fromCharCode() method, it can do pretty much the same thing, but also something extra. Its job is to return a string created by using the specified sequence of code points. This method is a static method, just like its predecessor from the previous article. But because browser vendors take forever to actually implement standards from many years ago, this one can be considered as quite a new one. Today, we will be talking about a method that was introduced in the ECMAScript 2015 version.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |