Hi Everyone,
I have just finished the “Mixed Messages” project and am happy to receive any feedback!
I found this project a little hard but it was because there was a mistake I did. It was challenging and I liked that.
This project took me about 1 day to complete.
Here’s a link to the project on Github:
const mixedMessages = {
badFeelings:['lonely', 'like giving up', 'neglected', 'disturbed'],
lowSelfEsteem: ['hating yourself', 'blaming everyone', 'screaming out loud'],
motivation: ['things will always be right at long last', 'God never forget about his children', 'your future is bright with hard work','you have the power to make everything right', 'there\'s always light at the end of a tunel']
}
const random = num =>{
return Math.floor(Math.random() * num)
}
let phrases = []
for (let arr in mixedMessages){
let mixMes = random(mixedMessages[arr].length)
switch (arr) {
case 'badFeelings':
phrases.push(`You are feeling ${mixedMessages[arr][mixMes]}`)
This file has been truncated. show original
What do you think of my project? do you have a different way to do it? if so, I’d really love to know-how.
Thanks.
1 Like
Looks pretty solid to me!
The only thing I’d recommend is to create a third function to wrap lines 13 → 32 that return the joined phrases. Then log the result of running that function. It would make things more modular and keep your “phrases” variable out of the global scope which would protect it.
I’m going to attempt my first pull request and implement this
1 Like
thanks a lot for your help…