In Ruby is there a way to combine all array elements into one string?
Example Array:
@arr = ['<p>Hello World</p>', '<p>This is a test</p>']
Example Output:
<p>Hello World</p><p>This is a test</p>
In Ruby is there a way to combine all array elements into one string?
Example Array:
@arr = ['<p>Hello World</p>', '<p>This is a test</p>']
Example Output:
<p>Hello World</p><p>This is a test</p>
Here's my solution:
@arr = ['<p>Hello World</p>', '<p>This is a test</p>']
@arr.reduce(:+)
=> <p>Hello World</p><p>This is a test</p>