Message Mixer Project/ Intermediate Javascript

  1. Hello Coders! Anybody could me to right place to get some guidance with the course Intermediate Javascript? I dont know Codecademy has an specifiy area to discuss this course in this Discord community. The issue with this course is there are some project where they didnt over the CODE SOLUTION or a least a video to follow along if you are really stuck. For example on the project like “Build a Library” they didn’t offer the Code Solution but there was link to see Matt’s video to code along with him. Thanks to Matt I managed to understand the code and finished but now I am working on the “Message Mixer” and right on task number 9 is where I got stuck. Not only is difficult to understand what the codes do in the three modules but specially the methods on the encryptors.js module which has complex functions inside but then when is difficult to understand what they ask on each task. For example the hint on #9 the shows: return reverseCipher(symbolCipher(caesarCipher(str, 6))); this is like chinees to me . Is there anywhere a video explaning this project or somebody explaining the code? We are here because we dont have the $6000 for a crazy bootcamp but give a project with no solutions or guidance is no wise teaching. This is only #9. But I have read that a lot of fellow students are stuck with #10 and #11 and cannot finish the project. (edited)

Here is the link: https://www.codecademy.com/courses/learn-intermediate-javascript/projects/message-mixer-node (edited)

It’s helpful to keep your eyes on the forest and try not to get lost in the trees. The details of the algorithms are important in their own way, but you can complete #9 just by looking at the big picture.

The caesar cipher is pretty easy to work with, but it is also too easy to crack. So the lesson is proposing that we not just encode our message with a caesar cypher, but that we take this message after it’s been encoded, and then encode it again with a different kind of encryption algorithm. So if I encode “hello” with a caesar cipher that moves everything up 4 letters in the alphabet I would get "lipps". This might be too easy for someone to figure out, so we could pass "lipps" into another encoding function. Then it is double scrambled.

Passing "lipps" into symbol cipher gives us "1!pp$". All this function did was change the letters into a symbol if there happened to be a symbol that looks similar to that letter. “L” looks like a “1”, “i” looks like a “!”, “s” looks like a “$”. There’s no symbol that looks like “p” so those just stay the same. Now we have a double encrypted version of “hello.”

The lesson is then proposing we take our double encoded message, "1!pp$", and pass that yet again into another function to make it triply encrypted. The final encoding method they give us is reverseCipher(), which reverses the word.

I’ll leave the rest for you to figure out, but I will hint that you may find it easier to do it in steps and save your results as you go. Rather than reverseCipher(symbolCipher(caesarCipher(str, 6))), try let caesarEncrypted = caesarCipher(str, 6);. Then you can pass caesarEncrypted into symbolCipher() as its argument and save that result. Then pass that into the next one… Take it in bite sized pieces.

Thank you davejandrea! Now is making more sense with your explanation. But I still don’t understand why they forgot the two p’s from “lipps” on the const symbols = { …} why not ‘q’ : ‘p’’ >>>> q is p in reverse.

And how the follinng code works that if the symbol for p is not in the code then use p instead:

let output = ‘’;

for (let i = 0; i < str.length; i++) {

let char = str.toLowerCase()[i];

if (symbols[char]) {

  output += symbols[char]

} else {

  output += char;

}

}

return output;

}

So like this:

const encodeMessage = (str) => {

// Use the encryptor functions here:

const caesarEncrypted = caesarCipher(str, 6);

const symbolEncrypted = symbolCipher(caesarEncrypted);

const reverseEncrypted = reverseCipher(symbolEncrypted )

return reverseEncrypted;
}

Just a quick note on how confusing some of the tasks are:
On task #4 on the same project Message Mixer they ask:

  • Declare a new variable called encryptors .
  • Then, import the module.exports object from encryptors.js and assign the imported object to encryptors .

But the actual thing to do on this task was ONLY to declare encryptors :
const encryptors = require(’./encryptors.js’);

nothing else …the importing of the 3 methods is on task#5.

Then there the issue of formulating the task in way that is more clear like:

  • Declare a new variable called encryptors .
  • Then, assign the encryptors.js module to this new encryptors variable resulting on this:

const encryptors = require(’./encryptors.js’);

that’s all. There should haven’t been no mention what so ever about module.exports object on this task because then student will get crazy because they will start thinking about the 3 lines of code they wrote on encryptors.js to be able to export the 3 methods:

module.exports.caesarCipher = caesarCipher;
module.exports.symbolCipher = symbolCipher;
module.exports.reverseCipher = reverseCipher;

in fact why are they asking to the module.exports object while even the HINT they ask for a module: Use the require() function to import a module.

Really? If Javaschipt ES6 is difficult for us (starters) and Node.js to that bad task formulations and them you will get a lot of drop outs.

"This is an arrow function, but is also a class, method of an object that could be a promise too, I promise this is a piece of cake trust me? "…"what are you talking about Willis? :rofl:

1 Like

I finally resolve 9 , it was not working because there was a code error on task 8, then I did 10 and 11 too is all good now. I really wished they also explained how the methods worked.

Congrats on completing it! I won’t lie, this is a tough topic and a big part of them problem is that JavaScript has too many ways of doing the same thing. The instructions probably could be a bit clearer, but it’s a convoluted topic anyway. I almost always have to google exporting and importing modules every time I do it because I can never keep it straight. Ironically, it’s much easier in Java and C++ (the most damning insult one can give a coding language :rofl:).

For task #4, if you defined the module.exports as an object in the following way, the instructions make a lot more sense. The module.exports object they refer to would be the one below.

module.exports = {
  caesarCipher,
  reverseCipher,
  symbolCipher
};

They offer this as a off-handed suggestion in the hint for #2. They should have been more explicit about doing it this way, given that’s how the instructions were written

3 Likes

Thank you! davejandrea

1 Like

Very interesting discussion glad that I came across such informative post. Keep up the good work friend. Glad to be part of your net community. We are best software development company in delhi.