Source Code
// Encryption - basic
const pt= "hello world"//plain text
const ky = 6 // key
const encrypt = (p,k)=>{
const ch = p.split("")
const cipher = ch.map((_,i)=>p.charCodeAt(i)+k)
return String.fromCharCode(...cipher)
}
const cp = encrypt(pt,ky)
console.log(cp)// cipher text ok