Basic Algorithm Scripting - Title Case a Sentence

Hi fCC fam, could someone help me understand the difference in these iteration methods//// for (let x IN x) and for(let x OF x) also when should i be using one or the other (x as placeholder)

Your code so far

function titleCase(str) {
  let s = str.split(" ")
  let update = []
  for(let l in s) {
    
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.35

Challenge: Basic Algorithm Scripting - Title Case a Sentence

Link to the challenge:

1 Like

Have you tried searc.

‘MDN JavaScript for in’

and

‘MDN JavaScript for of’

No, ill go check it out right now thanks

MDN describes it better than I can

1 Like

Yeah i just looked at it, the “under the hood” processes are a little bit confusing but i think i understood it. The property enumeration and array iterator parts

Yeah. One of them gets keys and the other values, in object sort of lingo. I always mix up which is which and have to double check.

in keys and of values

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.