DEV Community

Discussion on: Mar. 13, 2020: What did you learn this week?

Collapse
 
metalmikester profile image
Michel Renaud

Well, it's kind of weird saying that but I've been working with JavaScript for a while and yesterday I had to write a class. I had actually never written one in JS, mostly doing functional programming. The task at hand just felt more natural using a class.

So I learned about the intricacies of class variables, properties and methods. I got a lot of "unexpected..." or "undefined..." errors until I got the syntax right. That first JS class tutorial I looked at had a lot of errors in it. lol

I also found that I had to be careful about the syntax of a callback passed to findIndex (for arrays). I wasn't getting any error but always got a -1 result until I found that the syntax there was... hmmm... a bit simpler than what I've been doing for things like event listeners.

All frustrating at first, but in the end it all worked and it's a win. :)