You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While objects have legitimate use cases, maps are usually a better, more powerful choice. When in
787
+
doubt, use a `Map`.
788
+
789
+
```javascript
790
+
// bad
791
+
constme= {
792
+
name:"Ben",
793
+
age:30
794
+
};
795
+
var meSize =Object.keys(me).length;
796
+
meSize; // => 2
797
+
me.country="Belgium";
798
+
meSize++;
799
+
meSize; // => 3
800
+
801
+
// good
802
+
constme=Map();
803
+
me.set("name", "Ben");
804
+
me.set("age", 30);
805
+
me.size; // => 2
806
+
me.set("country", "Belgium");
807
+
me.size; // => 3
808
+
```
809
+
784
810
### Curry
785
811
786
812
Currying might have its place in other languages, but avoid it in JavaScript. It makes your code harder to read by introducing a foreign paradigm while the appropriate use cases are extremely unusual.
0 commit comments