Cipher v1

The encryption function.

Skills: InputOutputVariablesIf StatementsLoops
0.25%

Brief

Write an app that encrypts a sentence into numbers using the character codes of the letters, separated by pipes (|).

The user should be able to write any sentence they like into an input, click a button, and be given the encrypted output, e.g.

this is a secret message

encrypts to...

121|111|117|32|97|99|116|117|97|108|108|121|32|99|104|101|99|107|101|100|33|

Here's some references to help you write this app:

You can use the Svelte example below if you need help to get started. It contains all of the code for this program. If you can, try to complete the program without looking at it.


Sandbox

Feel free to play around with the example below to see how the web page reacts to your code changes in a consequence-free environment. You won't break or overwrite anything so go for gold.