79374626

Date: 2025-01-21 13:44:26
Score: 0.5
Natty:
Report link

Hi I found it in this way to insert any string or char at any position

function strInsert(str, inxAt) {
  let newStr = (str.split("")).reduce((a, b, n) => {
    return n === inxAt ? a + "-" + b : a + b
  }, '')
  return newStr
}

console.log(strInsert("9998888", 3))

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Vinod Poorma