Zoltar Fortune Teller

Hi,
I just finished the Mixed Messages Portfolio Project ! I decided to do a Zoltar Fortune Teller inspired randomized message generator. I’m a self-taught coder, so I’m still trying to understand and get into the swing of things.

I would really appreciate anyones feedback on what I can improve on. I used the coding example on the website as a template since this is my first off-platform JavaScript project.

Hi Sherida,

I’ve taken a look at your submission but sadly it doesn’t appear to work.
Have you tried running the code yet?

Let me know if you fix it and I’d happily take another look for you.

Cheers,
Charlie

Yes I was running into the issue of it not working, and have tried figuring out why it won’t but to no avail.

I’ll try again this afternoon and repost the link !

Ok, I think I was able to figure it out ! Here’s the new link :

Hi Sherida,

Fantastic! Good work on getting your code working :+1:
I was able to run your code this time and had my fortune told by Zoltar :crystal_ball: :partying_face:

I’ve had a look at your code - here is my feedback:

  1. It looks like you’ve implemented a couple of different approaches to the project in your code, then used one in such a way that it is dependent on the other:
    a. You’ve started to take a nice simple approach using randInfo and randAdvice on Line 7 - 10 but then haven’t actually used randInfo and randAdvice later in your code to output the message.
    b. You’ve also implemented a more complicated approach on Line 19 - 35. This approach might be good if you wanted to easily add more types of messages but you’ve then made the approach reliant on the info and advice arrays that you created for the first approach.
  2. I liked that you separated the message generation from the message output and that you created a function to handle the formatting/output of the message - this should allow you to reuse this code in other places/contexts such as on a webpage.
  3. Keep an eye on your code-style, it’s good practice to end lines of code with a ; and good indentation makes for more easily readable code. Your indentation is pretty good apart from the code blocks on Line 29 - 33.
  4. You may want to rethink the argument that you’re sending to the generateRandomNum function on Line 22 or alternatively where you pull your message from on Line 27 & Line 30…
    a. What happens if the info array and advice array on Line 6 & Line 7 each only have a single item in them? Try it out.
  5. Less important but it might be worth reviewing the Codecademy section on Markdown for your README.md file.

I hope that’s helpful! Let me know if you decide to make any changes and want me to take a look.

Cheers,
Charlie