How to use the flat() method to flatten Arrays in JavaScript?

How to use the flat() method to flatten Arrays in JavaScript?