Oldie trying to learn Javascript

Hi,
I am an oldie, trying to learn Javascript.
i came across Exercism and thought it looked like a good idea and worth giving a try.
I managed the first 8 tracks of Exercism but I have come to a complete block on track 9 (Mixed-Juices).

I tried to debug the problem (using the console.Log commands, but these were never displayed on the console).

I tried to skip this track and continue onto the next step but couldn’t.

i could not find any way to solve the problem, could not see any HELP option.

I am obviously doing something stupid but not knowing how the system works I am stumped.

I WANT to continue using Exercism but feel that I need more information/ Help in getting familiar with the system but do not know where to look for that help.

Any offers of assistance would be gratefully received !!

Thanks for reading my note.

/MarkL

6 posts were merged into an existing topic: About the JavaScript category

You’ve come to the right place to ask for help!

To help debugging, the Javascript track does support showing the output of console.log statements when the tests fail, here’s an example:

However for the tests to fail, they have to actually run. It seems that in your case the tests aren’t even running to completion, which makes you not see any console.log output.

If you are comfortable using the terminal, you can setup the Exercism CLI and install Javascript locally. Running things locally has the advantage of giving you more control and you can actually see what your program is producing, even if it doesn’t run to completion.

If you are not comfortable using the terminal, that’s ok too. In that case, can you provide us your solution so we can check it? Ideally you could ask a mentor to check your solution, but when using the online editor you can only request mentoring with passing tests. If using the Exercism CLI, you can request mentoring even with failing tests. To paste code here in the forum, surround it with 3 backticks and the name of the language. For instance:

image

Will appear as:

const x = "Hello!"
console.log(x)

@MarkL please copy and paste your limesToCut function (as text, not as an image). There’s potential there for an infinite loop.

/**

  • Calculates the number of limes that need to be cut
  • to reach a certain supply.
  • @param {number} wedgesNeeded
  • @param {string[]} limes
  • @returns {number} number of limes cut
    */
    export function limesToCut(wedgesNeeded, limes) {
    const sizes = [‘small’, ‘large’, ‘medium’];
    let limesCut = 0 ;
    let wedgesCut = 0 ;
    do {limesCut; (limes.length) > limesCut; limesCut++}
    while ((limes.length) > limesCut) {
    switch (limes[limesCut]) {
    case ‘small’:
    wedgesCut = wedgesCut + 6 ;
    limesCut;
    break ;
    case ‘medium’ :
    wedgesCut = wedgesCut + 8 ;
    limesCut
    break ;
    case ‘large’ :
    wedgesCut = wedgesCut + 10 ;
    limesCut
    break ;
    }
    } while (wedgesNeeded >= wedgesCut) ;
    return limesCut ;
    }

Please investigate how to format code in a post: Supported formatting in posts (markdown, BBCode, and HTML) - users - Discourse Meta

If I apply some formatting to that code, I see

export function limesToCut(wedgesNeeded, limes) {
    const sizes = ['small', 'large', 'medium'];
    let limesCut = 0 ;
    let wedgesCut = 0 ;

    do {limesCut; (limes.length) > limesCut; limesCut++}

    while ((limes.length) > limesCut) {
        switch (limes[limesCut]) {
            case 'small':
                wedgesCut = wedgesCut + 6 ;
                limesCut;
                break ;
            case 'medium' :
                wedgesCut = wedgesCut + 8 ;
                limesCut
                break ;
            case 'large' :
                wedgesCut = wedgesCut + 10 ;
                limesCut
                break ;
        }
    } while (wedgesNeeded >= wedgesCut) ;

    return limesCut ;
}

do and while (...) {...} while (...) need some attention.