Https://www.codecademy.com/courses/introduction-to-javascript/projects/message-mixer-node

https://www.codecademy.com/courses/introduction-to-javascript/projects/message-mixer-node
hello there !
able to complete the project but didn’t get this steps follows…

// Import the encryptors functions here.
const encryptors = require('./encryptors.js')
const { caesarCipher, symbolCipher, reverseCipher } = encryptors;
const encodeMessage = (str) => {
  // Use the encryptor functions here.
  return reverseCipher(symbolCipher(caesarCipher(str, 6)));
}

const decodeMessage = (str) => {
  // Use the encryptor functions here.
return caesarCipher(symbolCipher(reverseCipher(str, -6))); 
}

I did not get the code in line 4 and 9 encode and decode function

pls guide me.
thank you !

I didn’t get them too at first and I eventually did something that made more sense to me. But what the steps are asking you is to simply concatenate all the cypher methods together.

So in steps, to encode:

  • pass the string to the caesarCipher() first (which also needs the shift factor)
  • then encode its result with the symbolCipher()
  • finally encode its result with the reverseCipher() method

Obviously when you need to decode you must go through all those methods the other way around, so:

  • pass the encoded string to the reverseCipher() method
  • pass its result to the symbolCipher()
  • finally pass its result to the caesarCipher() (remembering what shift you used for the encoding)

Does this help?

thank you so much :+1:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.