30 Days Of JavaScript

Day 12: Classes

Lesson 0: Intro

Modern JavaScript makes heavy use of functions. The idea being that we make lots of little functions that can be put together and used in different ways to accomplish what we need. This idea is loosely referred to as Functional Programming. You can think of each function as a tool, when you need a tool you grab it from a drawer or cupboard and use it.

There is a different school of thought that says, rather than having lots of single tools that get used as and when needed, the tools are bundled up in to special multi-tools. We can then make copies of them as we need, that can be extended off further in the future as our needs change. This is loosely called Object Orientated Programming (OOP for short), and while it has fallen out of favour in the last 5 to 10 years, it is still a defining concept of JavaScript and something that you will need to be comfortable with.

So today we take a whistle stop tour though classes in JavaScript.

I said above that OOP has fallen out of favour in recent years. That might be the case but I'm going to let you in on a secret - OOP is still my preferred way to write code as I like how it creates useful little bundles of functionality that can be used to get stuff done and solve problems. Also, everything in JavaScript is an object at it's heart, so in my opinion writing OOP style code with JavaScript comes very naturally.

The reasons why OOP has fallen out of favour aren't really important though. I don't mind which approach you prefer but today you will learn why new Date() exists in JavaScript and why it matters.


Go Pro?

If you upgraded to pro, sign in here

  • About
  • Blog
  • Privacy
Looking to email me? You can get me on my first name at allthecode.co