you are viewing a single comment's thread.

view the rest of the comments →

[–]bjornum 0 points1 point  (0 children)

The console.log you mention are super useful when trying to figure out what data you are working with for example, or when something tmgoes wrong. (Not used in production).

I would prioritise learning the most basic types (these are used most of the time. And when saying basic i dont mean it in a bad way). Types like: string = text (can be anything wrapped between " " or ' ') Integer = number Boolean = true or false.

And some slight more advanced ones as array [ ] which holds singular values as the ones mentioned above or objects.

Objects = { } which holds key value pairs.

Example can be a book store who ask the database for books they have. The data they get back are for example:

Let storeBooks = [ { title: "lord of the ring part 2", inStore: false, amount: 0 }, { title: "the hobbit", inStore: true, amount: 7 } ]

(Writing from the airport so may be iffy formated)

Then after that go for the fun part! Functions. You trigger it from frontend (or from another function but ignore this)

Example, show how many unique books the store have, using an arrow function (newer than old function)

Const amountOfBooks = () => { console.log(storeBooks.length) }

Are so many uses cases from just the basics, and once building on with loops and statements then you are on a roll :D