function factorial(n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
console.log(factorial(5));
Please open Telegram to view this post
VIEW IN TELEGRAM
π€11π1
π22π€£7π€©1 1
A few months ago, we linked to Shikiji, a fork of Shiki that was created to push the project forward. Happily, the creators of both libraries decided to join forces and Shiki 1.0 was born. Itβs a syntax highlighter based on TextMate grammar and themes, the same engine as used by VS Code. The docs are good.
PINE WU, ANTHONY FU
Please open Telegram to view this post
VIEW IN TELEGRAM
π13 4β€2π€1π€©1π€£1
const obj = {
value: 42,
getValue: function() {
return () => {
console.log(this.value);
};
}
};
const getValue = obj.getValue();
getValue();
Please open Telegram to view this post
VIEW IN TELEGRAM
π17
π25π€9 7β€4
If youβve got a collection of large objects to print out, this could be ideal as it can format them into a table, dynamically size the columns as appropriate, sort the output, and let you add styling into the mix (including colors.)
LARS WAECHTER
Please open Telegram to view this post
VIEW IN TELEGRAM
π9β€1 1
const obj = { a: 1, b: 2, c: 3 };
let result = "";
for (const [key, value] of Object.entries(obj)) {
result += key + value;
}
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€12 2
π25 12β€5π€£4
We would like to ask for your help. Please boost us to continue sending stories on Telegram.
Please open Telegram to view this post
VIEW IN TELEGRAM
const string = "hello world";
const result = string.replace(/l/g, "");
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π€12 7β€4
π€£38π14 8β€3
I don't know why Iβve not linked this before, as itβs so useful. Playwright isnβt just a library for controlling browsers from JavaScript, but also includes a tool for generating tests and page navigation code from your own interactions. Hit record, do stuff, and code is written.
MICROSOFT
Please open Telegram to view this post
VIEW IN TELEGRAM
π10 6β€1π€£1
console.log(typeof null);
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£35 16π€9π€©4π2
π€£41π€13π11 7β€1
WinterJS initially pitched itself as a Rust and SpiderMonkey-powered βService Workers serverβ but now simply boasts being the fastest WinterCG-compatible JavaScript web server full stop. The ability to run JITed JS workloads entirely under WebAssembly is next on their radar.
WASMER
Please open Telegram to view this post
VIEW IN TELEGRAM
π15 3π€©2β€1
console.log(0.1 + 0.2 === 0.3);
Please open Telegram to view this post
VIEW IN TELEGRAM
π€21π1
π€£67π€48π13β€6 4π€©1
A thorough comparison of the template languages used by React, Vue, Angular and Svelte. Interesting analysis and this looks set to turn into a great series.
MAARTEN HUS
Please open Telegram to view this post
VIEW IN TELEGRAM
var x = 1;
function changeX() { x = 2; }
changeX();
console.log(x);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€13π€10π2