There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
Can someone please explain why ‘a’ is less than ‘b’? I think this has something to do with lexicographical order but I couldn’t really find a proper source of information about that.
Thank you so much for your response. Is there a link you would recommend that explains ordinal well? I’ve been searching but it’s so broad that I’m finding it difficult to understand why ‘a’ is 97 and ‘b’ is 98. I also don’t understand why ‘A’ is 65, but I’d like to know for the future.
Thank you so much for the links!!! The printable character list was exactly what I was looking for. I’ve never heard of any of this until now. It would have been nice information to be aware of going into the lesson, haha. Oh well, I’m beyond grateful to have it now, thanks again.
I’m digging into it right now, and expect you will be soon. Happy coding!
One supposes that was never considered. There are what would be best described as holes in learners’ knowledge base on any number of elementary concepts, as presented. On review it will be advisable to seek these out and address them in an appendix. The idea has crossed my mind several times, and perhaps now that the forum revamp is nearly complete, we can start one. Learners are often reporting that concepts are foreign. An appendix would be a place to find those concepts, and then resume the lesson with a better bearing.
Unlike a glossary, an appendix can actually explore concepts and let them play out. This let’s the reader leave with a package, not a definition.
The hints didn’t really help me here. I did not understand where I what I was supposed to type in order to find the error in the logic.
I first tried to log the value of firstLetter1 outside of the function and that just gave me a reference error. I next tried to log the values of firstLetter1 and 2 after their appropriate strings should they meet the conditions of the if/else block. That got me nowhere even though that was the method used in the previous example. After much frustration I just viewed solution, unfortunately.
But surely the solution could have been something I could have found if I had just stared at the code a bit longer. My hunch was that .charAt(1) is not the first character, going by what I learned about indexes at this point.
Here it seemed that the instructions and hints were cryptic and what worked in the previous lesson was of no help here.
Good exercise. Worth noting/reminding something that stumped me briefly - if you’re using a console.log() within the if/else block, make sure you do this BEFORE the return statement. If you put if after, nothing extra will be logged because return ends the function.
Please let me know if I did it correctly, although the solution gave me the answer to change ‘>’ to ‘<’
} else if (firstLetter1 < firstLetter2) {
return string2;
} else {
return string1;