function pigIt(str){
let latin = str.split(' ').map(x => x.slice(0,1) + 'ay')
let latinTwo = str.split(' ').map(x => x.slice(1, str.length-1))
for (let i = 0; i < latin.length; i++) {
let pig = latinTwo[i].concat(latin[i])
console.log(pig)
}
}
Testcase: Test.assertEquals(pigIt('Pig latin is cool'),'igPay atinlay siay oolcay')
My current array of pig contains = igPay atinlay siay oolcay
I am wondering how I can join this into a full sentence, I've tried using the join method... Any help is much appreciated!
I've tried using the join method however I get an error code.