How to Find the Repeated Number of an Array
1. What is the Difference between Map and Object?
- the key of the map can be any type, but the key of the object only can be string or symbol.
- the map has order.
The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and primitive values) may be used as either a key or a value.
2. How to Get the Target Item from a Array?
use the find
api of the Array Array.prototype.find()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
The find() method of Array instances returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
how to use: