Constructor chaining5/1/2023 PREVIOUSLY: // JavaScript stores numbers as floats, so there is always a bit of inaccuracy // but more importantly, there start to be inaccuracies for integer operations after a certain number. They can either be constructed using the BigInt() constructor (preferably with strings to prevent inaccuracies) or by appending n at the end of a number. BigInt: The new BigInt data type allows for accurately storing and operating on large (whole) numbers, which prevents errors produced by JavaScript storing numbers as floats. function formatNumbers(strings: TemplateStringsArray, number: number): string Let's say we want to write a way to log arbitrary strings containing a number, but format the number.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |