Practical Cryptography: "Caesar Cipher"
Read this page, which discusses the Caesar Cipher. First, go through the mathematical description and JavaScript example. Then, read through the cryptanalysis to learn how to break the cipher.
Click http://practicalcryptography.com/ciphers/classical-era/caesar/ link to open resource.