ES6 Day 2: Homework and correction

Hey all!

Congrats on making it through week two of the free JS bootcamp! We’ve covered a lot, haven’t we?

Remember to not get overwhelmed. This is meant to be self-paced. We’re all collaborating on our learning, so please ask and answer questions.

:loudspeaker: Quick reminder about homework for the next session!
Next Monday we’ll start with Regular Expressions, so your homework is to complete and revise the ES6 module

:loudspeaker: Minor Correction from ES6 day 2
Special thanks to Stuart Langridge for his help with this!

It is totally possible to have a mix of a default export and module exports in an ES6 module:
https://exploringjs.com/es6/ch_modules.html#sec_mixing-named-and-default-exports

Remember folks, you’re not alone.
Don’t hesitate to seek help in the js-help channel or on the forum!

Be sure to collaborate, stay hydrated and get plenty of rest!!!

We’re all in this together!
Happy Coding!
#PatPat🤚

3 Likes

ES DAY 2 Homework: Completed.

3 Likes

Hello, please I have a slight challenge with my previous homework on basic javascript. Please, can you help me out with the codes on how you ran it…thanks!

1 Like

Hi Abiola,

To help you better please let us know what exercise you got stuck on, and what you have tried yourself already? You can post your code examples here between ``` code code code ``` to make it appear like a code block. Like so:

code code code

Or put your code in an online place from where you can share like codepen.

Screenshots help too!

We do need to understand what you are struggling with to be able to help you.

Apologies, I really thought I dropped the codes here. Totally skipped my mind.





These are the exercises left giving me challenge.

Hi Abiola, that is quite a bit to go through.

First of all may I point you to the option to make proper screenshots in future? Windows has a nifty tool built in called the ‘snipping tool’ How to Use Snipping Tool (Beginners Guide) - YouTube or its alternative the ‘snip and sketch’ tool How to Use Windows 10 Snip & Sketch (Beginners Guide) - YouTube which allows you to make each screenshots that are much better readable for us that want to try and help.

Then let’s go through your code bit by bit.
‘Selecting from many Options with Switch Statements’ (your picture IMG_20220916_163115_726.jpg and IMG_20220916_163041_019.jpg)

This problem is being discussed here:

Take a look and see if that helps you.

The second problem, is kind of the same, but it does require you to understand how a switch works. I have a post here that tries to explain the switch with examples:

See if that gives you some understanding, with this clue and the previous assignment I think you may be able to solve it.
A few tips here:

  1. Do not try to just ‘copy’ what you see in the example on the page but look at the construction of the function to start with. See how it gets a parameter val in the function call function switchOfStuff(val) { ...} ? That means we do not know about a ‘num’ but only about a ‘val’, and that is what we should test.
  2. There is a default call to the function at the end switchOfStuff(1); where you can see that the value that is passed into the function is a number. But then you call it with console.log(switchOfStuff(a)); how is it to know what a is? You did not put it in as the letter a, because that would have been “a”, but like a variable a without assigning it.

Your switch statement here in itself is very close to correct though, just have another try after you read the linked posts. I am sure you will get it - if you need more help - just shout out!

Then the Card Counting problem. That is a really tough one, but we also discussed that a few times. See if the above posts in combination with this one help:

You may want to browse up a bit in that thread to see Lina’s question too. She was also very close in solving it. Let us know if you need further help with any of these after reading through the posts and trying the exercises again! You got this!

3 Likes

Hi @abiolajinadu2949710

When you start to write something here you will se a menu bar with a few icons at the top. You also can expand the text box all you want using the arrows at the top right.

I think the easier way to share links and code it is copy and paste it in the textbox and then select the code you have paste and click on the icon that it looks like this </>

The same way works with links. I use to write the title of the link and then click on the chain icon, after cursive one I. For example, there is a JavaScript and HTML DOM Reference in W3Schools. What I did here was select the text “JavaScript and HTML DOM Reference” and click on the chains icon, it will pop up a window where you need to paste the actual link, the selected text it will be the title of that link so to speak. You also could link to freeCodeCamp challenge to make other even easier to help you. ;D

I hope that helps.

2 Likes