Solución

@3dg4ryz·22/6/2026TypeScript
solution.tsTypeScript
export function rot13(text: string): string {
  let cypheredText = ''
  for(let i=0; i<text.length; i++){
    const charCode = text.charCodeAt(i)

    if(charCode < 65 || charCode > 122 || (charCode >= 91 && charCode <= 96)){
      cypheredText += String.fromCharCode(charCode)
      continue
    }

    let base = charCode < 97 ? 65 : 97

    cypheredText += String.fromCharCode((((charCode - base) + 13 )%26) + base)
  }
  return cypheredText
}
0respuestas
Respuestas

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.