- when using an arrow function, and want to pass an object 's property by destructuring, even if only one parameter, needs to add a paranthses.
let f = ({name}) => name == "Tom";
- when using reduce function ( the higher order function ), if only one element in array, it will return the element.
// it is better.
let name = counted.reduce((a, b) => a.count > b.count ? a : b).name;
// it may be got mistakes when only one element in counted array.
let name = counted.reduce((a, b) => a.count > b.count ? a.name : b.name);