Caesars cipher javascript freecodecamp. JeremyLT November 1, 2022, 4:33pm 2.

Kulmking (Solid Perfume) by Atelier Goetia
Caesars cipher javascript freecodecamp d0dy November 22, 2020, 8:07pm 1. Last time I tried to override the protection, I had a bad time. I don’t know what is wrong with “?” and why it is mix up with “Y” in my code. Remember, JavaScript is case-sensitive, so you must make sure you use the correct capitalization for function and variables names. In a shift cipher the meanings of the letters are shifted by some set amount. org freeCodeCamp. Caesar Cipher Hey all, I am having trouble with the Caesars cipher. Why is that? The answer is in your comments. The white space is getting translated into ROT13. Teller March 4, 2024, 5:51am 3. d0dy December 21, 2020, 9:48pm 1. peachtin July 10, 2022, 6:15pm 2. (Letters after M should be replaced by the letters that are 13 before them. colinthornton November 7, 2022, 5:35am 2. that gets changed to&hellip; Tell us what’s happening: Describe your issue in detail here. Tell us what’s happening: When I console. fromCharCode() to work. VahidPouyafar May 25, 2021, 4:43pm 1. Frustratingly if I console. To answer your question, if I understand you correctly, you are trying to find a way to feed an array of char codes (numbers) to the String. I’m aware that my solution is not the best but I wanted to do it in this way. Hi! Just finished writing the code for the challenge. A regular for loop is obviously better here, I used the for of since I was suggested to do so (and it was also a new experience for me anyway). ndegwaduncan193 May 6, 2021, 1:40am 1. tis is the codes : Tell us what’s happening: Your code so far function rot13(str) { // LBH QVQ VG! var codedLetter = ""; var uncodedLetter = ""; var newString = ""; for(var i=0;i I found the solution doing this: var charCodeToString = String. I’m not sure how to join “anotherArray” while also preserving the whitespace. This topic was automatically closed 182 days after the JavaScript. filter is generally going to be used to remove values from the array. I tried to do this with regular expressions and if statements but it doesnt work, can someone hint me into a solu *Tell us what’s happening: My output string has a dash between the words. I tried to troubleshoot it with console. Anyway, I read about the ASCII solution but I’m sticking to Tell us what’s happening: Describe your issue in detail here. I’m assuming you are wondering why the rot13 function doesn’t decode the string. You will need to spread out your array into arguments to fix the issue. Hi Coders, I completed this project using if and else if statements. You mean this is my code is doing? Caesars Cipher, this is a freeCodeCamp coding challenge. It should be working and I can't understand what the problem is. The or statement specifies that characters not found in the lookup object remain the same. join(""); directly at the end of the function. Do you know why you are getting undefined for N? Have you traced it out in your function? valedagradi November 19, 2022, 9:33pm 3. )” Should Iswitch it to like elem == "!"[] The freeCodeCamp Forum JavaScript Algorithms and Data Structures Projects: Caesars Cipher. How can I get for loop to continue to iterate through str after completing if statment? I realize there is probably a much easier way and more convention way to achieve Thanks for all your help and encouragement guys, been a tough week but I have finally managed to pass the project. i got them all decoded but i cant seem to figure out the puncuation at the end. fromCharCode() is as follows. The freeCodeCamp Forum Stuck on Caesars Cipher Challenge. For that I set up a else if statement just for that case, otherwise the code is ignoring spaces as well. Indeed, after googling “Caesar cipher in js” I saw many other approaches EDIT: Solution is gone from this post kinome79 March 12, 2023, 7:02am This topic was automatically closed 182 days after the last reply. 70,82,69,69,32,67,79,68,69,32,67,65,77,80 When I try to feed this to fromCharCode it doesn’t seem to function correc str. hbar1st September 23, 2022, 8:58am 2. What am I doing wrong? Your code so far function rot13(str) { // LBH The freeCodeCamp Forum Caesars Cipher, solution 3 - why % 26? JavaScript. antisankari December 17, 2022, Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. length; // Tell us what’s happening: I’ve used a million console. e. lestrangeqq: rot13("SERR YBIR?"); Caesars Cipher - Where am I going wrong here? JavaScript. oboe January 9, 2021, 6:44pm 2. 2: 214: September 27, 2023 Caesars So I have converted the coded letters into the real ones but now I have ended up with an array of all the correct letters like this: (14) [“F”, “R”, “E Remember to return the string. ILM September 27, 2022, 8:26pm 2. Djvious June 16, 2020, 3:27pm 1. Maybe it’s easier to “alert()” the last code rather than Tell us what’s happening: can someone help me figure out how to pass on the special symbols. length; i++) { unicodeArray. ohhhhh I see I want to say “if we dont have a letter, just push the non-letter character, else use the modulo operator (etc. I’m aware the are better solutions, but I’m just trying to see if I can tweak it to make it work. I really Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. The freeCodeCamp Forum JavaScript. replace() - JavaScript | MDN The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. Your code so far Challenge: Caesars Cipher. The freeCodeCamp Forum Caesars Cipher -Solved. I changed your code a bit by adding a variable assignment on line 4 and by returning the value from str. Tell us what’s happening: Hi all! This is my first post here so cut me some slack if my code sucks. org. fromCharCode(strArr); The way you use String. So i try to solve caesars cipher with for looping and indexOf array properties. 2: 510: January 25, 2021 Caesars Cipher Challenge. I have no Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. fromCharCode(80); // returns 'P' newStr. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. But please don’t just post your solution for the sake of sharing it. I am pretty much solved this algorithm challenge, but I do not know how to use regex to add in the spaces. Viewed 441 times 1 This is an encoder and decoder function, which takes an encoded value and returns the decoded value and it is called ROT13 Cipher where the values of the letters are shifted by 13 places. Earn certifications. If I print ‘arr’ before it’s return statement, the code works completely fine and all the results match (I gave all possible inputs to cross-check and the The freeCodeCamp Forum Caesars Cipher Project Feedback[spoiler] JavaScript. JeremyLT September 6, 2022, 3:14pm 2. My question: How do I pass the return statements to replace the text in “inputbox”? My understanding is that the return statements pass to the caller which i think should replace the text in “inputbox” upon Tell us what’s happening: Hey, i got a problem to push spaces and non letter character into my resultArr. fromCharCode. 2. bbsmooth February 28, 2023, 8:22pm 2. Learn to code. Tell us what’s happening: Describe your issue in detail here. My code is not working, i want to replace the letters in the string with the letters that are 13 after them in alphabetical order. I get the correct values for free code camp. Write a function which takes a ROT13 encoded So, I have managed to get the code to function correctly and seems to be working to all the test cases, however now I am returning the result and the test cases are still saying that they are failing, but when I console. Finally able to complete this section with the below code. freecodecamp. How is this? Any feedback, please? Thanks function rot13(str) { let newStr = ''; for(let i=0; i I have a working answer to the Cipher. GuillermousK October 5, 2022, 8:06pm 2. Create an empty string to store the A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Challenge: Caesars Cipher. Of course, that doesn’t take an array, but a list of numbers. Could you explain in plain language how your algorithm is supposed to work? 1 Like. length; x++){Do you want to keep searching in this loop after you swapped your letter out? kwstas November 1, 2022, Tell us what’s happening: I’ve understood, that my code is not very beautiful, but can’t understand why the “undefined” is printed before my result? Could anybody help me? Your code so far function rot13(str) { // LBH The freeCodeCamp Forum Caesars Cipher need help with my code. (which is javascript syntax). Recognize alphabet ASCII is You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). log() and I still don’t quite understand what my code is doing. what that means is if a string (lets say the word “string”) is 6 characters long, the index of the last letter would be 5 (it starts counting from zero. JavaScript Algorithms and Data Structures Projects - Caesars Cipher. apply(null, porTraducir); return charCodeToString; But I am not sure about what Null does. Teller December 11, 2023, 5:35am 2. Tell us what’s happening: Can’t figure out how to get the array or string from numbers back to letters. A We would like to show you a description here but the site won’t allow us. fromCharCode([65, 66, 67]) (The above is the same as String. log newstring. New replies are no longer allowed. Happy coding. andrebdinis December 18, 2022, 12:48am 3. JeremyLT November 1, 2022, 4:33pm 2. . system Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Hi, I have been trying to complete this challenge for 2 hours and I’ve ended up with a code that seems to work as per console logs but doesn’t pass the tests. fromCharCode(characterNumber) is a method of String. This is decoding using the Caesar cipher. noname123456789 November 18, 2017, 9:05pm 1 **Tell us what’s happening:**I’m getting the correct number of output characters in the last array, but each character is showing as null. I could also just hard wire non non-letters into the case list but that seems like cheating. system Closed February 7, 2023, 2:52am 3. At first I thought that quotes must be returned as part of the answer, So I tried that, to no avail. Amanhas2492 June 11, 2018, 11:45am 1. push(splitted[i]) What is the purpose of this line at the very end of the for loop? Also, you forgot about this part of the instructions: Tell us what’s happening: Hi there, i am trying to convert str to an Array with the ASCII code but I dont know what I am doing wrong and my newArray is not storing the values Your code so far function rot13(str) { // Hello campers, I am working on Caesars Cipher and I am lost I need your help. split(":") returns an array with the Tell us what’s happening: Describe your issue in detail here. moose_brown62 August 14, 2019, freecodecamp. First you replace the As, so it becomes "NBN". Hi @hjm! Welcome to the forum! I moved your question out of the year old post and into a new topic because you will get more responses this way. I may have been a bit messy with my forEach() loops, but I cannot at all figure out why this is happening. I’m sure this isn’t the most effective solution, but it was what I started with and if not right route, point how I can make it better! Thank you 🙂 PSEUDO: Define variables. Tell us what’s happening: My Caesar Cipher is only working for every odd character in my parameter; the result should be “FREE CODE CAMP”, however, I’m getting “FEER CBDR CNMC”. Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, Challenge: Caesars Cipher. JavaScript. split(""); will not change the string str but instead return a new list. What did I wrong and even with my third else if statement why is it ignoring all marks and sapces? thank The freeCodeCamp Forum JavaScript. whbob March 2, 2022, 9:18pm 1. freeCodeCamp. We would like to show you a description here but the site won’t allow us. As far Thank you for this. But when testing it for something else the results are just weird, returning red and / or wrong letters. Tell us what’s happening: I think my answer is similar to the suggested answer but why cant it returns the same answer?? Challenge: Caesars Cipher. hbar1st November 9, 2022, 9:02pm 2. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on. I think it has something to do with how the replace method works. Is there a more elegant way to So when i console this the outputs seem fine in console and it converts all cipher into translated english but the issue is the challenge is not completed. 3: 513: February 2, 2021 Caesars Cipher - need help! 6: 864: The freeCodeCamp Forum Need help with Caesar's Cipher project. To fix Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. push(str. You appear to have created this post without editing the template. Try it and find out! Get used to exploring ideas in code rather than being told what you can and cannot do. Check the characters in your alphabet. However I am having difficulty translating the ciphered code back into letters. Please help me! **Your code so far** function rot13(str) { let letters = { "A": "N", Good work getting a passing solution! A few notes. You’re missing one and you have a duplicate of another. Could someone please tell me what is the problem? **Your code so far** function rot13(str) { var ans = ''; function de_code(boi) { let num . Tell us what’s happening: When I do calculate the UTF-16 code - 13 some letters do not match, for example the R becomes an 8 I also can’t figure out how to modify only the A-Z characters from the string Challenge: Caesars Cipher. // Use the map function to convert characters into their Caesar cypher equivalents. Ask Question Asked 3 years, 11 months ago. Caesars Cipher Rot13 - problem with Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. dayna-j January 26, 2018, 7:37pm 1. I have an idea, I’m currently Yes i figured that out when i checked again string’s length. What’s happening: Hey everyone, Ive gotten so close to solving this. Plus, the added letter is not even the one that should go for the input string’s first letter. The alternative that I'm proposing to your example is just a Continuing the discussion from freeCodeCamp Challenge Guide: Caesars Cipher: Here’s my solution to the Caesars cipher challenge; my question is, is any of the proposed One way to create a Caesars cipher requires the developer to do the following: 1. What happens if you replace A with N and then N with A ? Honey1835 November 19, 2022, 7:58am 3. i solve it and pass the task. fromCharCode is indeed not a function. As the name already suggests, it splits a String on a specific character that you provide. Many thanks for any help out there. I’m so close to solving it but I don’t understand why after every word the Good day to all. Somehow that returns “THE QUICK BROWN DLOG JUMPEDL OVER THE AZQ FOX. Caesars Cipher. So the thing is that split does not help you with that. As far as I’m concerned my solution does work, but isn’t validated by the site. Example: String. Learn to Code — For Free. I’m sure this has something to do with the way I s Tell us what’s happening: I already feel a lot stupid because of the code I have written and I know there exists a really better way to make this challenge work but since I wrote it, I would love if someone can just help me make it work the right way. I’m still String. This code seems to not recognizing a question mark ( 63 ) or a exclamation mark ( 43 ) . Home ; Subforums ; Guidelines Tell us what’s happening: i seem to be getting close but any hints would be appreciated as to why i am getting the right output but missing only a few letters in the translation i am lost as to where i went wrong and rather get some advise before looking at answers as this is the first day ive been able to start completing code challenges independently and it feels damn Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Full process and solution here: Caesars Cipher Project Help Ultimately took a similar approach to you snowmonkey, just coded one step at a time until I was getting near enough the end product then spent some time debugging until the code I don’t know what’s wrong with my code. This topic was automatically closed 182 days after the last reply. m4rk December 30, 2020, I am going to move this to the javascript section instead. The CharCodeAt() method requires a bunch of parameters. Since 2015, 40,000 graduates have gotten jobs at tech Your code : str. Ah, I see what I think is happening. Your code so far JavaScript. Hi, why wont my function below return white space and other non-alpha numeric characters from input? [SOLVED]Caesars Cipher - Can any one tell me what i am doing wrong in this code? JavaScript. charCodeAt(0); var abr; var arra = []; var arraye; f The freeCodeCamp Forum JavaScript. bbsmooth November 19, 2022, 9:25pm 2. charCodeAt()); } block of code works (I understand I am somehow using a string method on an array) but this next block of code One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. push(newArray[i]. Am I doing something not correct or is it freeCodeCamp bug? Your code so far function rot13(str) { // I am trying to create a basic web interface to use Caesars Cipher. JeremyLT August 9, 2022, 7:55pm 2. But on a site all tests are mis Hi, My code is working in ciphering this challenge. The unicode for the space between the words are being counted as well?Would I have to use the replace method to get rid of the dash? Your code so far function rot13(str) { // LBH QVQ VG! var charNum = []; var numHolder = []; var asciiValues = []; str = str. I want The freeCodeCamp Forum JavaScript Algorithms and Data Structures Projects - Caesars Cipher. ilenia June 27, 2022, 8:30am 2. This string of alphabets would be iterated to return the correct ciphers. below is my code to decode the caesars cipher project. Ideas? Your code so far function rot13(str) { var nArr = []; var number; var letter; for (i=0; i<str. Create an alphabet string. push() is not a function because you cannot use push on a string. I have gotten to the point where I am able to take a encrypted character and use it to find its index in the alphabet and add or subtract by 13 places respectively. I know the elements need to be joined to create a string in order for String. Hi @h81371417. Here is my code Caesars Cipher. New Hi, I am working on the Caesars Cipher project. Adler October 6, 2022, 11:58pm 14. But, i still confused in this part : alpha[(ind + 13) % 26 if you guys have some ref for me learn more deep about part that i confused, please share to me. a<var<b). mr. However, I cannot use This topic was automatically closed 182 days after the last reply. It is a type of substitution cipher in which each letter is the message is replaced by a letter some fixed number of positions down the alphabet. Since 2015, 40,000 This topic was automatically closed 182 days after the last reply. The code works for one letter strings, but fails to loop back through remaining string. prototype. Hi, I hope some can help me understand what is going on with my code. everything works fine except the special characters. The freeCodeCamp Forum Caesars Cipher null output. You don’t need an else if, only an else. It needs to iterate through the string and return a string with all of the letters shifted up 13 characters. I'm trying to complete the Caesar Cipher Project and why after every word the function adds the letter "M"? I didn’t want to go easy and use another array of ciphered equivalent letters and simply just loop through them. B7R_Ace June 7, 2021, 10:42am 1. I am having a problem in my code where the replace method is occasionally replacing the wrong letter. system Closed March 10, 2023, 5:02am 3. fromCharCode(n1, n2, , nX) String in syntax doesn’t mean you can replace it with any string, that’s part of syntax they don’t accept any string variable, they only accept integer variable inside their bracket I am about halfway through with the Casesar’s Cipher puzzle. helium1 April 8, 2023, 9:23pm 3. replace() to tweak it. I can’t tell you much as it is a certification challenge, but think if you can’t find it, maybe there is another type of characters that can help you? Look for Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. marcelinnoj: My second for loop is reversing the changes made in my first loop. Tell us what’s happening: Trying to create an if statement within a for loop and another for loop within else statement. This is one of the 5 project tasks. hjm January 9, 2021, Has anyone else struggled with Caesars Cipher project in Javascript? jwilkins. function rot13(str) { // LBH QVQ VG! let alpha = ['A', 'B', 'C', 'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S Tell us what’s happening: Hi everyone, So far I could get the decrypted strings, but I am not able to process only letters from A-Z and leave all the rest untouched. It is a type of substitution cipher in which each letter is the message is I recently came across a free code camp problem while solving JavaScript Algorithms and Data Structures certification. Can we solve the same in another way? PortableStick June 11, 2018, 12:09pm 2. log but it returns, what seems to me, the correct solution. In your code you are passing a string to the function and using the variable str within the function. Please, can someone help me? I’l give you special thanks to my #100DaysOfCode log My code: function rot13(str) { // var x = 0; str = I have the logic down and all the characters are translating nicely I am just struggling to figure out how to keep the punctuation of the original string in my new one. Link to the challenge: freecodecamp. The Algorithm is incomplete, so disregard the last line of code. you need to avoid feeding it special characters. charCodeAt(i) to add to the array. That’s because you have to write the function. if statements and regular expressions, help. You Tell us what’s happening: I have gotten this far. I got a problem with this challenge. When you assign Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. **Your code so far** function rot13(str) { // Alphabet Array Tell us what’s happening: Hi everyone, I’m trying to wrap up the cipher problem. Now we're doing the Caesars Cipher. bbsmooth June 18, 2023, 2:11am 2. freecodecamp. PhilWatkins April 7, 2018, 4:28pm 1. It passes 3/4 test cases. log the result they match the test case criteria. coder9 January 11, 2019, 5:21pm 1. I don’t know if my approach to this algorithm might work but all I’ve managed to do is basically create a alphabet and empty array for the characters that exists in the string, then I’m looping through the alphabet to see which characters exist in the str and pushing them to the empty array. "foo:bar". Need feedback on my Javascript for Caesars Cipher. fromCharCode() method won’t convert the character codes back to their respective characters (see commented out text toward bottom). Example: If using a left shift of 3, D would be replaced by A, E would become B, and so on. HI Tell us what’s happening: My code works for the letters but I forgot about punctuation. That’s not what I want. ) The problem is, there is no such string function called CharCodeAt which you attempted to use on str. julie. system Closed May 8, 2023, 5:36pm 3. function rot13(str) { // LBH QVQ VG! JavaScript. TheOctagon3323 November 7, 2022, Hi! I have written a code which solves a freeCodeCamp Ceasars Cipher task, but it is not accepted by onsite system. Hey alexsrebernic, I see. Here is the code: function rot13(str) { var ciph=[]; var decoded=[]; var len=str. String. Yeah, I mentioned this method before. hbar1st November 7, 2022, 1:13am 2. I have tried my code on the editor many times and it doesn’t seem to work. I don’t understand why the String. You might get more responses there. Code Feedback. bozek August 26, 2021, 1:08pm 1. g. fromCharCode and passing in a variable. I get all the right results but for some reason my solution does not pass validation I also didn’t use ES6 and cannot see Caesars Cipher freecodecamp project. You should be done at this point, but Your loop keeps going and eventually replaces the Ns, so it becomes "AOA" and then replaces the O' so it becomes “ABA”`. jcasasmail April 22, 2020, 8:30pm 1. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match. Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft. I need help with my Caesars Cipher project. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read. Google something called an ASCII table and then google up how to get the ASCII value of any character in JavaScript. This video covers: What Caesar Ciphers are; What ROT13 Ciphers are; How to encode and decode strings using ciphers; What accumulators are (useful for later JavaScript) An efficient solution with linear runtime O(n) and more! Hi there folks, I just completed a few solutions to the Caesar’s Cipher project and was reading with interest the in depth explanation of the modulo operator as provided in the solutions. system March 3, 2024, 7:43pm 2. The first loop takes all the Tell us what’s happening: Is this code unsavable? I have an array of the decoded cipher already, but to get that I removed everything that Isn’t a letter from the string and now I can’t add them back (for example, white spaces and punctuation) Your code so far function rot13(str) { let nArr = [] const letters = (() => { const caps = [Array(26)]. The Regex doesn’t appear to be catching all letters and the 13 being added to each charcode doesn’t seem to be working as expected. 2: JavaScript. The main problem appears to be with the whitespace in the array. I’m having trouble understanding why i cant use a range (i. Challenge Link:-freecodecamp. map method might be affecting how the charCodeAt and fromCharCode methods are behaving and I’m trying to find a solution. len Tell us what’s happening: Hiya, I’m having a heck of a time trying to join the elements of the array of the code points for the challenge. I thought characterCodeAt(0) going to convert all the array into Unicode, but it only converted the first index, thanks Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Adler October 6, 2022, 10:07am 1. I also would have thought since “S” should be a match based on the regex, it should show test result is “true” instead of “false”, and only after that, it will show the “lastIndex” is now “1” (since it matched at 0), instead of “0” as is displayed. A switch statement may not have been the best choice but I wanted the practice. sanity June 7, 2021, 7:06am 2. Refactoring. Notice for example that you are not feeding Tell us what’s happening: I’m getting a ‘Potential infinite loop error’ on line 9 (the If statement). You have spaces in the string. This means that after each function call completes, subsequent This topic was automatically closed 182 days after the last reply. Hello & happy Thursday fellow coders! I feel like i am on the right path with the logic here, but i can not execute the final steps of what I am trying to do - convert the ASCII code back to a string. What is your question? With what exactly do you This topic was automatically closed 182 days after the last reply. JeremyLT November 19, 2022, 7:20am 2. 6: 922: January 18, 2021 Caesars Cipher - problem with for loops. Your code so far function rot13(str) { // LBH QVQ V What does the failing test say? Decodes everything correctly, but the task is not considered completed. I will need to do some research on implementing it here. Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Hey! My post is very late and I’m sure you’ve managed to solve this but I’d take another look at your code block where you check for special characters. Asj_ASJ June 7, 2021, 5:52am 1. I created a for loop to sift through the numbers, and used result. toUpperCase();//changes the Tell us what’s happening: Describe your issue in detail here. i can’t figure out what is wrong here function rot13(str) { // LBH QVQ VG! Firstly,according to the problem statement you are supposed to decode only the uppercase letters where the character code is between 65 and 90, but your program decodes all the characters whose char code is >= 65 or <=90 which also includes space because the char code for space is 32 and is sure <= 90. 2: 1122: October 31, JavaScript. system Closed June 10, 2024, 5:35pm 3. Help please. fromCharCode it works! Your code so far function rot13(str) { let answerArray = []; for(let I’ve edited your post for readability. map((val, i) => String. Amanhas2492 June 12, 2018 Continuing the discussion from freeCodeCamp Challenge Guide: Caesars Cipher: Here’s my solution to the Caesars cipher challenge; my question is, is any of the proposed solutions in the challenge better performance wise than mine? because it didn’t seem that way at first glance. However, str. This means that after each function call completes, subsequent function calls start with the previous value. Why is this happening? Need feedback on my Javascript for Caesars Cipher. Clearly, I’ve done something wrong in one (or both) of the for loops, because it keeps adding the same letter to the string that’s supposed to be the output. I understand how the remainder of a number by a divisor maps that number to a range of [0 , divisor - 1] but somewhere the explanation says: Now let us Hi guys, So I came up with a lengthy solution to the Caesar’s Cipher challenge. fromCharCode(12); the syntax for fromCharCode() method is. 2: 267: September 29, 2021 My solution Caesars Cipher. I’ve read some notes elsewhere but am trying not to spoil solutions. Your code so far function rot13(str) { // LBH QVQ VG! var arr=[]; The Caesars Cipher is a certification Project from JavaScript Learnings in www. Assalmulaikum Sir in my code the problem I am facing is that when I console the char code value using function charcodeat it gives me the wrong answer only when I am performing this in array plz check my code especially line 3 and line 9 (when i is 4) **Your code so far** function rot13(str) { let How can I concatenate the strings inside a for loop to solve the Cipher? I tried to do as it follows, but my result var just show the first letter. system February 28, 2024, 1:13pm 2. log the values of this variable and copy and paste them into String. chan1997 January 1, 2021, 2:58am 1. This I have a problem because according to me, the results that my algorithm returns are good, however it does not pass the test. Below is my code. Any help would be much appreciated. Please check solution 3 on this link. I Caesars Cipher - test dont pass even though code is working. fromCharCode” part of the code given below ? Your code so far Tell us what’s happening: Hi there! As a continuation to learn, I hope you can assist me in debugging my code. blakek May 5, 2019, 4:35pm 1. Tell us what’s happening: Okay, so my letters are converting to their proper required values, but I don’t know why my non-word chars are also converting. JeremyLT August 8, 2022, 2:52pm 2. ”, but with HUGE spaces beetwen words. Look at a more complete test case: console. At me all tests pass for all test data which are offered on a site freecodecamp. I am using String. Build projects. Your code contains global variables that are changed each time the function is run. I know there’s something wrong with my regex (or the if statement Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Our job is to take a ROT13-encoded string and return it as a decoded string. var text = String. JeremyLT July 28, 2023, 1:28am 2. ) I wrote the code below, you can see my solution, yet it still not working, when i use return i get the same result as before writing the JavaScript Algorithms and Data Structures Projects - Caesars Cipher. push() is for an array. *Problem Statement *: One of the simplest and You can build the algorithm for ROT13 directly or just use a Caesar Cipher algorithm with the appropriate key. But I cannot work with the Spaces between the “Free Code Camp” and the special characters in other test The freeCodeCamp Forum Caesars Cipher. What I am wondering is why my for (var i = 0; i < newArray. fromCharCode(65, 66, 67); The way you don’t use String. Modified 3 years, 11 months ago. 1 Like. Or the ones which are before them by 13. akari2: result. I am using the code from the basic solution given by this forum (which is similar to my own). if i were representing an array, remember that arrays are zero-indexed. fromCharCode(NaN), by the way). E. I’m not quite sure what the core issue is, but I recommend you 1) don’t start variable names with capital letters 2) use conventional formatting. A common modern use is the ROT13 cipher, where the Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Secondly,add 13 to characters whose char code is I would have thought at the very start, the “lastIndex” would be “0” not 1. I ma trying to solve the Caesar’s Cipher algorithm, and code seems to work for individual letters and also for couple of “opposite” letters. log(rot13("abcdefghijklmnopqrstuvwxyz")); 1 Like. Caesars Cipher - so close but not all numbers converting to proper characters? JavaScript. Then you replace the B, so it becomes "NON". join(" ") should be join("") Challenge: JavaScript Algorithms and Data Structures Projects - Caesars Cipher. Tell us what’s happening: Hi everyone. String. So now I am debating the use of . then again, i’m a begginer =) The freeCodeCamp Forum My solution Caesars str. Thanks for the answer. To be honnest, I have a problem with regular express JavaScript Algorithms and Data Structures Projects - Caesars Cipher. 2: 919: February 2, 2021 Caesars Cipher: How to add back spaces. That variable only exists inside of your for loop. length is not. Learn to Code — For Free The freeCodeCamp Forum Caesar's Cipher help. Since this newly created list is not stored in a variable, it is lost. Suppose your word is "ABA". I will still give it few more hours but I need help with few things If you understand my approach then please help me Tell us what’s happening: Can Anyone explain “/[A-Z]/G, L => String. I had the same issue with a space ( 32 ). The problem: I am then trying to to transform the index back to its character representation in the sequence using the alphabet variable just before I push to the Tell us what’s happening: I think the . Please edit your post to Tell us what’s happening in your own words. indexOf() and/or . Tell us what’s happening: Challenge: Caesars Cipher. This video covers: What Caesar Ciphers are; What ROT13 Ciphers are; How to encode and A Caesar cipher, named after Julius Caesar, is a simple algorithm for encrypting secret messages. Considering the reduce method - thank you for the idea. Since 2015, 40,000 graduates have gotten jobs at tech companies including freeCodeCamp Learn to code with free online courses, programming projects, and interview Learn to code with free online courses, programming projects, and interview preparation for developer jobs. One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. Help me, please function rot13(str) { // LBH QVQ VG! var ass; var stre = str. That’s an interesting way to solve the problem! It took me a while to figure out how it worked, but it obviously does. I am able to convert the values to their respective Rot13 values. I don’t suggest a switch approach to this, but you can make is eork. Note - it is easier if you use meaningful variable names and good formatting. Thank you very much! It was so easy, but I let it out of my sight Now, I understand A Caesar cipher, named after Julius Caesar, is a simple algorithm for encrypting secret messages. zhouxiang19910319 January 19, 2019, 3:01pm 1. Tell us what’s happening: I managed to decode the string but in the process I deleted the spaces, how do I go about modifying only the characters [a-zA-Z]? Challenge: Caesars Cipher. If the condition is not true, then it is automatically false. kwstas: for (let x = 0; x < alph. Everything was going so well up &hellip; The freeCodeCamp Forum Caesars Cipher Algorithm Challenge: output seems correct, answer rejected. JeremyLT February 15, 2023, 4:59pm 2. KatyaBarta January 1, 2021, 4:23am 3. Teller February 28, 2024, 5:23pm 3. What you want is for the character codes for non-letters to go into your fixed array without being changed (without adding 13) or for those to be changed back to their original values in your for loop (less efficient of course, but perhaps easier for you since you already have some logic like this). aegbsoc vvhau rygqly diud eatfn eymt wiq kvwml dpwe lhtz