DEV Community

Arttu Pyykönen
Arttu Pyykönen

Posted on • Updated on

Day 3 of 100DaysOfCode

Started the day by working on my TaskTimer project. It's meant to help me keep track of the time spent on various tasks, including my 100DaysOfCode journey. Spent a good chunk of time making sure the script could save the task and time it took on a Python dictionary.

After that, I decided to familiarize myself with some more JavaScript. I had already started the Eloquent JavaScript book and now continued from the fourth chapter.

Chapter four of EJS is all about data focusing on objects and arrays. My favorite part about the book this far is the way the author explained how bindings work.

"You should imagine bindings as tentacles, rather than boxes. They do not contain values; they grasp them—two bindings can refer to the same value. A program can access only the values that it still has a reference to. When you need to remember something, you grow a tentacle to hold on to it or you reattach one of your existing tentacles to it." Link

What I did today:

1. Worked on the TaskTimer python project

Working on the GitHub to make it public. In the meantime go check out the first version on my website.

What I changed:

  • Added hours to the script
  • Made that the script saves to a .txt file
  • Made that the script reads a .txt file and adds the data to a dictionary
  • Made that the script writes the new task added to the dict into a txt file

2. Reading and exercises of chapter 4 of Eloquent JavaScript

https://eloquentjavascript.net/04_data.html

What I learned from it:

  • Three dot notation to pass individual items from arrays to function arguments.
  • What are arrays and objects
  • What is JSON

Time spent learning:

Task "Coding TaskTimer" 1 h 19 min 15 s
Task 'Reading EJS'. Elapsed time: 31 min 19 s
Task 'Excercices of EJS'. Elapsed time: 19 min 57 s

Time spent actually coding:

1h 39 min

Total Time: 2h 10min 31s

Tracked by using my TaskTimer script and the WakaTime app

Where you can learn more:

Eloquent JavaScript book (free and interactive)

Summary of chapter four which is about data:

"Objects and arrays (which are a specific kind of object) provide ways to group several values into a single value. Conceptually, this allows us to put a bunch of related things in a bag and run around with the bag, instead of wrapping our arms around all of the individual things and trying to hold on to them separately.

Most values in JavaScript have properties, the exceptions being null and undefined. Properties are accessed using value.prop or value["prop"]. Objects tend to use names for their properties and store more or less a fixed set of them. Arrays, on the other hand, usually contain varying amounts of conceptually identical values and use numbers (starting from 0) as the names of their properties.

There are some named properties in arrays, such as length and a number of methods. Methods are functions that live in properties and (usually) act on the value they are a property of.

You can iterate over arrays using a special kind of for loop—for (let element of array)." End of summary, check this part from here

Also, check out FreeCodeCamp the best learning site for beginner coders.

That's it for today. Hope to see you all tomorrow!

Top comments (0)