It's the time of the year in Malaysia where the national flag can be seen everywhere, so I included a tiny history piece as the third item. The first two items are both JavaScript - one on array and another on Base64, the latter seems like it can become a whole article of its own but I kept it short.
JavaScript - array:
[...x]
will result in an array ifx
is iterable.Array.from(potatoes, (potato) => potato)
will also result in an array ifpotatoes
is iterable, butpotatoes
can also be an array-like object, e.g.{0: small, length: 1}
, that allows us to create a transformed array out of an array-like object, e.g.const dinner = Array.from(potatoes, (potato) => cook(potato))
.JavaScript - Base64: while
btoa()
andatob()
can be used in a browser environment to convert between binary data and Base64 encoded string, they have recently made their way to Node.js as well but use them wisely because character encoding can be tricky and Base64 encoding can easily increase the data size by a third.History - Malaysia: the founding father - Tunku Abdul Rahman was part of the panel of judges that contributed to the Malaysian national anthem. "We're not going to War. We don't need this. We need a love song.", and surely enough, now the national anthem has its root in the melody of a love song.
This is my 7th weekly post since July 2021, thank you for reading and do let me know if you have any feedback by leaving a comment.
Related Links
- MDN on Array.from(): developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
- MDN on btoa(): developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/btoa
- Goodreads - Dialog: Thoughts on Tunku’s Timeless Thinking: goodreads.com/book/show/58679923-dialog
Top comments (0)