A functions quiz which I have struggled a bit with. Any help?!

Agreed also! I am working on improving this skill!

Okay, I remember your twitter shows a teenager, and in some countries, they don’t understand our American sarcasm. You seem like a sweet kid, so a sarcasm-free discussion of good variable names can be found here: http://wiki.c2.com/?GoodVariableNames

Edit: Just realized that may be too much depth, and isn’t really written well for the new programmer. I’ll find something better. BRB.

Re-edit: Found a good one that covers all the points that matter: https://medium.com/coding-skills/clean-code-101-meaningful-names-and-functions-bf450456d90c. Read only until the “Functions” heading. Everything beyond that in the article doesn’t apply to the points @ilenia and I are making, and will likely be confusing. But up until that point, it’s all good.

1 Like

Gotcha, but if I didn’t call it num, I’d end up with a not-solved quiz. They are who asked for that, so I will go for the soap idea with you but not in my coffee of course! :rofl:

1 Like

I am totally for the soap in the coffee thing
Variables names like num, obj, str, arr should have values of number, object, string and array, respectively, or it would just be totally confusing for whoever read it.

Write a function called laugh() that takes one parameter, num that represent the numbers of "ha"s to return

Reading this you have actually failed the exercise… num should be the parameter of the function, so a number

function laugh (num) {
   let lol = ...
}

Same names but less confusing and actually respecting the quiz instructions

2 Likes

Oh, this looks so generous! Thanks a lot! :pray:t2:

1 Like

No problem. I like helping out those hungry for knowledge.

1 Like

Agreed! It seems better this way!

That’s because you’re a gentleman, sir! And it’s my pleasure to see me as a sweet kid! Also, something gives me more confidence (with my language at least because I am still working on improving it!) to keep moving forward that you think I am an American! I am not, but hopefully, I’ll be there soon. I am an Egyptian in fact, but I think the same sarcastic soul is something we are sharing! :sweat_smile:

I didn’t think you were American, although your English is excellent. I meant that sometimes humor doesn’t translate across cultural boundaries. The threat of a practical joke (like soap in coffee) may just be seen as funny in one country and very offensive in another. I’m glad to learn Egyptians find it funny, too. Then again, like 80% of your country is less than 25 years old, right? I’m sure you know way more about what’s trending on Youtube than I do.

1 Like

Thanks so much for the encouragement. I got the point.

1 Like