Struggling with subLength() challenge

help with SubLength

Hello to anyone reading this, I am currently struggling with eh subLength() challenge and am in great need of help, I just cant wrap my head around this challenge and struggling to even understand it when looking at the solution, could anyone get me a step by step reply super simplified and also point me in the direction of what material to go back and go over again, I am currently doing full-stack-engineer course

Here is the link I thought I attached it prior … apologies

Since the problem involves the string between at least/at most two characters, including those characters, String.split() seems like a good place to start.

const x = string.split(char)

If and only if there are exactly two chars we should expect an array with length of three. That becomes our condition.

if (x.length === 3) {
    return ____
return 0

What should we return?

1 Like

I believe it = true;

I struggle with absorbing info, and a lot it feels like, it is mentally draining but I’m still in it to win it.

Drop that code into your function and see if you can figure out what to return. Hint: x.length will be two less than what it needs to be since it is only the length of the string in between the two chars.

For the sake of practice, try your hand at using .split() on a few sentences so it becomes comfortable. The secret to ‘absorption’ is repetition. Do something enough times so that it becomes natural and you understand and recognize the nuances of the concept and method.

Also, do not neglect reading the documentation on each new function or method. MDN is a perfect site to turn to, so bookmark it.

could you also point me back on the full-stack-engineer course on where to go over and redo so I cant attempt more repetition, will do some examples with .split( now and get back to you)

I don’t know that syllabus so cannot really point to what to review. Take the time out of that track to go and complete the Learn JavaScript track which will is more complete coverage of the basics/fundamentals.

I believe this part i am on in the full-stack is the same as just the Learn JavaScript course,

i have completed obect and step below but it has bugged out.

Does the Functions section cover any of the built-ins? Strings, numbers, arrays and objects have their own built in methods. For instance, .split() is a String method, with a corresponding Array method, .join() that can return an array back to the string that it was split out of.

Regardless that you have nearly completed the track, there is nothing restricting you from going back over the lessons and doing some practice right there in the lessons.

I am certain that doesn’t have that in this section, should I maybe reset my progress and go through it all again, that way I cant jump ahead and will have to complete it all to get onto the next step.

also on these challenges some wont state I can go over other material and google/mdn ect ect, am I allowed to google/mdn/forums ect and look for info that could help me progress?

You should be able to review all the completed lessons/units without resetting. Just use the workspace as a sandbox. Leave your original work in place so your can review and sample your practice after it.

Bottom line, there is no race. Take your time and work with each concept until you are comfortable and trust in your ability to work with it.

As for challenges, you can pause them any time and go back to the lessons for review, you can search the forums or use Search on the web. How you improve your understanding is up to you, and you will not be penalized for doing your own research. The lessons are not exhaustive so fill in whatever holes may crop up in your understanding. Also, you can use the workspace in your profile as a sandbox and be able to save your work, there.

Thank you mtf, that is the bottom line of it for me, I need to take it nice and slow feel confident in telling my self I repeat until like you said u until I am more than comfortable with it, could you also link me to that learn java script track just so I can make sure, it is 100% the one i sent a screen shot of and if it isn’t then i can utilise that also.

1 Like

I believe it is this one…

You can find the link in your My Home page, or in your Profile.

That seems to be linked on to my course so thats good, i crack on with going over that again

1 Like