scrimba
Note at 0:18
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Note at 0:18
Expand for more info
main.js
run
preview
console
function insertDashes(arr) {
// write code here
let a = arr.split(" ");
//console.log(a)
for(let i=0; i<a.length; i++) {
if(a[i] !== " ") {
a[i] = a[i].split("")
a[i] = a[i].join("-")
//console.log(a)
}

}
let b = a.join(" ")
//console.log(b)
return b
}



/**
* Test Suite
*/
describe('insertDashes()', () => {
it('insert dashes in between chars', () => {
// arrange
const value = "aba caba";

// act
const result = insertDashes(value);

// log
console.log("result: ", result);

// assert
expect(result).toBe("a-b-a c-a-b-a");
});
});
Console
"result: "
,
"a-b-a c-a-b-a"
,
/index.html
LIVE