Mixed Messages - Zoo Tour Random Sentence Generator

Hello dev friends.

I’m here to show my work in this portifolio project: GitHub - cc-random-message-generator
I’ve always had a knack for programming and now I’m learning JavaScript.
Found this task a little ease so I complicated a bit.
Made it for 2 languages message generator.
At the end of the file I’ve put some calls to the function as examples.

I’m brazilian, but I’m always trying to let my codes in english too.

Would appreciate feedbacks if something can be better in any way.

Alexandre Marques

Oi!

I’m a portuguese dev and I really liked this project having both English and Portuguese support, I think it’s a very nice touch.

As I ran your program, I noticed it was generating a message with portuguese and english mixed in. Taking a closer look at it, you have a mistake on your subjects array:


The coelho object has the same translation in english and portuguese.

I also have a little question here where you put AND for this condition. I would have put an OR (but I’m also just learning lol), why did you choose the AND?

<if (choice !== ‘BR’ && choice !== ‘EN’)>

Votos de uma excelente semana!

Hi Joana

I really forgot to translate ‘o Coelho’ into ‘the rabbit’.
I put too many animals and didn’t notice him among the others.

<if (choice !== ‘BR’ && choice !== ‘EN’)>

I made use of the difference between ‘BR’ and ‘EN’ so I don’t have to use an if/else statement.

I could use:

if (choice === 'BR' || choice === 'EN') {
  the entire program here;
} else {
  warning messages;
}

This would do the same result.
My choice was only to have a clean code.

Thanks a lot for seeing my codes.

Good studies !!! Bons estudos parceira de carreira…

1 Like

Hi again Joana

Already corrected the translation.

Here is the change!

Right now I’m finishing my portfolio challenge.

Will post it soon.
Good night.

1 Like