const secondStringRotatedOfFirstString = (first, second) => {
if (first.length !== second.length){
return false
};
for (let i = 0; i < first.length; i++) {
const rotated = first.slice(i).concat(first.slice(0, i));
if (rotated === second) {
return true
};
}
return false;
};
const first = 'abcdefg';
const second = 'cdefgab';
console.log(secondStringRotatedOfFirstString(first, second));
/*
run:
true
*/