Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 666 Bytes

sentence_smash.md

File metadata and controls

24 lines (20 loc) · 666 Bytes

Description

Sentence Smash

Write a function that takes an array of words and smashes them together into a sentence and returns the sentence. You can ignore any need to sanitize words or add punctuation, but you should add spaces between each word. Be careful, there shouldn't be a space at the beginning or the end of the sentence!

Example

['hello', 'world', 'this', 'is', 'great'] => 'hello world this is great'

My Solution

def smash(words)
  words.join(' ')
end

Better/Alternative solution from Codewars

def smash(words)
  words * ' '
end