Help! ==> Learning Basic Algorithm Scripting

Tell us what’s happening:
Today I finished Basic Algorithm Scripting: Title Case a Sentence challenge. And I noticed that the solutions for every challenge are very hard to read and I think these solutions are for intermediate level
Also every time I see methods on these challenges that we did not learned them yet?
So what do you advice me about these solutions learn them or what?

Your code so far


function titleCase(str) {
let newStr = str.toLowerCase();
let arr = newStr.split(" ");
  
for (let i = 0; i < arr.length; i++) {
  arr[i] = arr[i][0].toUpperCase() + arr[i].substring(1);
}

return arr.join(" ");
}

console.log(titleCase("I'm a little tea pot"));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:83.0) Gecko/20100101 Firefox/83.0.

Challenge: Title Case a Sentence

Link to the challenge:

Don’t worry about it too much.

You finished the challenge? Good. Be proud of that. This stuff is hard.

Yes, there is often more than one way to solve these. And sometimes the solutions are written by more advanced people trying to show off. And don’t assume that because a solution has fewer lines or use some “sexy” feature, that it is inherently better. Your solution is straightforward and easy to read.

So be proud of your solution. That being said, it can be worth wile to see other people’s solutions. You’re not there yet in terms of understanding them? That’s OK - this stuff is hard and takes time. Maybe just do a couple quick google searches and get the gist of what they are doing for now. And if you’re really stuck on understanding one of them (after you’ve tried), ask the forum.

1 Like