Just a few days ago, Bun was released - Bun v1.0 - the first stable version.
The JS community has been really active these last few days. People are playing around with Bun, testing, and doing benchmarks.
Bun goal is to replace Node.js, and it claims that it's better, faster, and simpler to use. It reduces complexity by having a lot of tools built-in.
In this post, I'll compare the two and outline their pros and cons.
The difference between
var is the scope in which the variables are available.
let declares a block-scoped variable. They are accessible only within the block (enclosed by curly braces) in which they are defined.
var declares function scoped or globally-scoped variable. This means they are accessible throughout the entire function in which they are defined or globally if defined outside of any function.
But what does that mean? Let's look at the examples below to understand the differences better.