koehr.ing/content/til/2024-09-06.smd

18 lines
352 B
Text
Raw Normal View History

2024-09-06 13:33:13 +02:00
---
{
.title = "Javascript's Array.from is neat!",
.date = @date("2024-09-06T00:00:00"),
.author = "koehr",
.draft = false,
2024-09-16 22:02:39 +02:00
.layout = "til.shtml",
2024-09-06 13:33:13 +02:00
.description = "",
.tags = [],
.custom = {},
}
---
Because it simply executes a function arg1.length times, one can do things like:
```ts
const randomNumbers = Array.from({ length: 75 }, Math.random)
```