Daily Shaarli
October 9, 2022
const moreInfos = { info: "Please go to the desk." }
return {
address: "20B Rue Lafayette",
postcode: "75009",
...(moreInfos !== undefined && { moreInfos })
}
In JavaScript, primitive values are Number, String, Boolean, Undefined, Symbol, and BigInt. Other data types are passed by reference, which means that the variable is given instead of just a copy. Modifications happen in-place.
An example of Weakmap: https://gist.github.com/PaulRosset/0d4e3a9b9af20f9997b41d15f70c8808#file-weak-map-js. Everything can be a key.
5 Best practices for Clean Code every Javascript developer should know | by Vitaliysteffensen | Medium
Clean code is not only concise code, but more importantly, it is readable. A rule of thumb when writing code, is to write code as if comments didn’t exist. The code should be self-explanatory.
- booleans should always have a prefix like "is", "has", or "was"
and other JS tips
The thing is some are already on https://1loc.dev/
Others can be added :)