My First Post
I'm going to start documenting all the new things I pick up as I learn web development.
- In CSS, I should use the transform attribute for visuals, instead of width/height. Using transform wont affect the layout
- In JS, the difference between for(item in n) vs for(item of n) - "in" returns an index, which naturally can make code harder to read when you use array index. On the other hand, "of" returns the actual object, and so you can write item.style for example, no need to index yourself. Supposedly its also slightly less error-prone, but its not a huge difference.
- fetch needs a particular sequence. its first fetch(url).then(return=>{response}).then((data)=>{this is where you work with data}).catch((err)=>{where errors are handled}). fetch also returns a promise, so I can also do (const data = await fetch(url); )