JavaScript is the world’s most popular programming language and it is very cool.
All here runs whit Deno, not Node.js.
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, this means that configuration is not necessary and you can import Typescript files into Javascript files without any problem, so it was very easy to port all 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.
E.g: Import algos/primeNumber.ts:
import isPrime from "https://raw.githubusercontent.com/UltiRequiem/javascript/main/algos/primeNumber.ts";
console.log(isPrime(5));
Things that I liked and I want to save them to review them in some future.