9504 shaares
222 private links
222 private links
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.