Message Mixer

Hello

Could you please help me as i have problem in step 11. It said i have syntax error, i checked it many times but i didn’t see any error. COuld someone help me ? I attached my Terminal screenshot.

thanks

// Import the encryptors functions here.
const {caesarCipher(), symbolCipher(),reverseCipher()} = require('./ encryptors.js')

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);
 
}

// User input / output.

const handleInput = (userInput) => {
 const str = userInput.toString().trim();
 let output;
 if (process.argv[2] === 'encode') {
   output = encodeMessage(str);
 } 
 if (process.argv[2] === 'decode') {
   output = decodeMessage(str);
 } 
 
 process.stdout.write(output + '\n');
 process.exit();
}

// Run the program.
process.stdout.write('Enter the message you would like to encrypt...\n> ');
process.stdin.on('data', handleInput);

Hi,

By your error message, the unexpected token is a comma.

This means that the compiler is getting a comma either where none should be, or where it was expecting another token (like a parenthesis or bracket, for example).

I would particularly check your function calls (look out for multiple arguments and parenthesis is my tip), particularly around the lines the error suggests.

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