Skip to main content
Deno 2 is finally here 🎉️
Learn more

JavaScript

GitMoji License: MIT

JavaScript is the world’s most popular programming language and is very cool.

All here runs whit Deno, not Node.js.

FAQ

  • “Hey, everything here is TypeScript, not JavaScript!”

It’s because I had a lot of functions like:

/**
 * @param {number[]} arr
 * @param {number} max
 */

function biggerThan(arr, max) {
  return arr.filter((num) => num > max);
}

And in TypeScript, it would be:

function biggerThan(arr: number[], max: number) {
  return arr.filter((num) => num > max);
}

Deno treats TypeScript as a first-class language, which means that configuration is not necessary, and you can import TypeScript files into JavaScript files without any problem, as these snippets were mostly independent, it was very straightforward to port everything to TypeScript.

I ended up passing even what was not needed to TypeScript because I didn’t like that the repository was half TypeScript and half JavaScript.

  • “I want to import your code.”

E.g: Import algos/primeNumber.ts:

import isPrime from "https://raw.githubusercontent.com/UltiRequiem/javascript/main/algos/primeNumber.ts";

console.log(isPrime(5));

Bookmarks

Things that I liked and I want to save them to review them in the future.