how to does flat() javascript work code example Example: flat function javascript const arr1 = [1, 2, [3, 4]]; arr1.flat(); // [1, 2, 3, 4]