1
cloudsxvx
48d

this is my first actual rant. I am trying to learn es6 right now and have encountered switch statements for the first time. after a 26 minute video explaining how to do switch statements (which is literally just the same kind of information on them that you can get from w3 or mdn I am given a large task with no practice to create a switch function that hold four values two values containing positive integers and two values accepting strings. then I have to be able to pass days and minutes through it.
an example solution after input would be:
addTime(1,"hour",3,"minutes")
I feel like this is too complicated with 26 minutes of information and no practice exercises to prepare for that.
-end rant

Comments
  • 1
    From what little you've shared, their material does seem to be rather low quality.
  • 0
    @SortOfTested 1. Your function should include at least one switch

    2. Your function must accept any possible combination of inputs

    3. If the inputs are valid, it should return an array with 2 variables inside of it: value3, and label3. For example:

    return [5,"minutes"];

    The exact label you choose to return for label3 ("minutes" for example) is up to you.

    4. If the inputs are invalid or impossible, it should return false. Here are examples of impossible and invalid inputs:

    timeAdder(5,"hour",5,"minutes") // This is impossible because "hour" is singular and 5 is plural

    timeAdder(false,false,5,"minutes") // This is invalid because the first 2 arguments are not the correct types

    timeAdder({},"days",5,"minutes") // This is invalid because the first argument is the wrong type
  • 0
    @SortOfTested const expr = 'Papayas';

    switch (expr) {

    case 'Oranges':

    console.log('Oranges are $0.59 a pound.');

    break;

    case 'Mangoes':

    case 'Papayas':

    console.log('Mangoes and papayas are $2.79 a pound.');

    // expected output: "Mangoes and papayas are $2.79 a pound."

    break;

    default:

    console.log(`Sorry, we are out of ${expr}.`);

    }

    that's pretty much the example I got.
  • 2
    @cloudsxvx
    That's a pretty stupid exercise. Especially the part where the equate grammar to value. Pretty engrish. You also generally shouldn't have multiple return types from a single function.

    Any chance you could get your money back on the course? They're not teaching you anything useful.
  • 0
    @SortOfTested doubt it. I felt as if teamtreehouse was pretty good but my subscription ran out and I don't feel like resubscribing (I had an injury and I've been out of work, so I've dove into trying to learn as much as I can in the process) I just don't really know any good free ways of getting adequate.
  • 4
    @cloudsxvx
    Not gonna lie, I just read books and docs and write code based on what I read.
  • 2
    @SortOfTested that's awesome. I should try that avenue
Add Comment