Q. Given a string, you have to return a string in which each character (case-sensitive) is repeated once.
Examples (Input -> Output):
//#my solution
function doubleChar(str) {
// Your code here
let result = "";
for (let i = 0; i < str.length; i++) {
result += str[i].repeat(2);
}
return result;
}
//#other solution
const doubleChar = (str) => str.split("").map(c => c + c).join("");