How to implement a rot13 cipher in JavaScript
In this tutorial, you'll learn how to implement a rot13 cipher in JavaScript. Get my free 32 page eBook of JavaScript HowTos ? https://bit.ly/2ThXPL3
Follow me on Twitter: https://www.twitter.com/codebubb
Facebook: https://www.facebook.com/juniordevelopercentral/
Blog: https://www.juniordevelopercentral.com/
So what is rot13? It's a simple substitution cipher which takes some plain text and moves it 13 positions along the English alphabet.
For example, abcd === nopq.
The great thing about rot13 is that the encoding and decoding process or algorithm is exactly the same. So once you've written your rot13 JavaScript function it works for both encoding and decoding.
In the video, i'll discuss a couple of ways to implement a rot13 cipher in JavaScript.
The first is probably the more 'traditional' way of doing things whereby two alphabets are stored in variables, one being the 'input' and the second the 'output'.
You'll see with this approach that it's simply a matter of looping through a string and finding each character in the 'input' alphabet and noting its position and then adding the character in the same position to from the 'output' alphabet to the final output.
The other method we'll look at is using JavaScript array methods to loop through the string as an array and pick out the individual character codes (as numbers) from the String and shift them by 13 places either up or down the alphabet, depending on whether the character is in the first or second half of the alphabet.
So you're going to be learning how to encode rot13 JavaScript text and also how to decode rot13 JavaScript text.
Enjoy this Junior Developer Central JavaScript HowTo!
#JavaScript #JavaScriptHowtos #rot13 Channel Handle @codebubb
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «How to implement a rot13 cipher in JavaScript», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.