Entry tags:
$Objectification
Last night after watching Porco Rosso (more on that later), I went back to do more coding practice and spent a while banging my head against this lesson on destructuring assignment.
It took me a while to even understand what the lesson was asking me to do, since a string is a string, right? Javascript treats a lot of things as objects (like functions), but what I forgot is that it treats string as objects (the String object; note capitalization) sometimes too, like when you write:
it very briefly treats the string as a object with a 'length' property which can be read.
And since I forgot, I googled the lesson and found this thread about it, with a lot of people pointing out perfectly reasonable things like "why not just use .length?" and "The lesson doesn't actually explain why you would want to do this or what benefit it has, especially based on what it requires you to do." There is a post that links to another post with real-world applications, so I do understand why destructuring is good. It's much easier to work with name than it is to work with clientList[currentRegion].clients[i].lastName. But while doing it to a string is supposed to be an easy operation to demonstrate how it works, I don't think it succeeds.
Tonight is the first Anime Chicago event I'm going to, a discussion about Porco Rosso. More on that after it happens.
It took me a while to even understand what the lesson was asking me to do, since a string is a string, right? Javascript treats a lot of things as objects (like functions), but what I forgot is that it treats string as objects (the String object; note capitalization) sometimes too, like when you write:
str.length
it very briefly treats the string as a object with a 'length' property which can be read.
And since I forgot, I googled the lesson and found this thread about it, with a lot of people pointing out perfectly reasonable things like "why not just use .length?" and "The lesson doesn't actually explain why you would want to do this or what benefit it has, especially based on what it requires you to do." There is a post that links to another post with real-world applications, so I do understand why destructuring is good. It's much easier to work with name than it is to work with clientList[currentRegion].clients[i].lastName. But while doing it to a string is supposed to be an easy operation to demonstrate how it works, I don't think it succeeds.
Tonight is the first Anime Chicago event I'm going to, a discussion about Porco Rosso. More on that after it happens.