문제 링크 : Circular Sentence
/**
* @param {string} sentence
* @return {boolean}
*/
var isCircularSentence = function(sentence) {
const arr = sentence.split(' ')
for(let i = 0; i<arr.length; i++) {
const last = arr[i][arr[i].length -1]
if(i === arr.length - 1) {
if(last !== arr[0][0]) return false
}else {
if(last !== arr[i+1][0]) return false
}
}
return true
};