Covert array to string with newlines embedded in string
Convert array to string with newlines using join()
- The join(‘\r\n’) method is used.
- ‘\r\n’ is passed in as the method’s argument that acts as a separator while converting the array to string values. The array elements are divided into newline using ‘\r\n’.
- This string value is stored in finalString and printed on the console.