blog.rupertmckay.comAsynchronous Programming in TypeScriptKey takeaways: Promises can run code after some other code has completed async/await is just syntactic sugar Promise.all is great for parallel tasks What is a Promise? A promise is some task that we can use to chain together later tasks. For exampl...May 16, 2022·6 min read
blog.rupertmckay.comWhat is Memoization?Imagine I asked you to calculate 23 times 47. And let's imagine you don't have a calculator or your phone on you, so you have to do it the hard way using just a pencil and paper. Your working might look something like this: 23 * 47 = 20 * 47 + 3 * 4...Feb 28, 2022·6 min read
blog.rupertmckay.comSorting in JavaScriptJavaScript arrays have a builtin sort method, which mostly does what you expect: [1, 4, 2, 3].sort(); // [1, 2, 3, 4] ["d", "a", "b", "c"].sort(); // ['a', 'b', 'c', 'd'] But it has some quirks. For examples numbers are sorting as though they were s...Jan 17, 2022·8 min read
blog.rupertmckay.comWhat is a number?TL;DR: No datatype will ever be able to represent all numeric values perfectly Rounding errors will always exist JavaScript uses floating-point numbers which are sufficient for many use cases If this is not sufficient for your use case... JavaScript...Jan 3, 2022·10 min read
blog.rupertmckay.comReact Testing Library RecipesAs long as I've been working in frontend development, the tools available for testing UIs have felt clunky, hard to use, and not filled me with confidence that they reflect real end-user experiences. I was especially tired of libraries that directly ...Dec 4, 2021·6 min read