[DAY 33-35] I Built A Statistics Calculator, A Spreadsheet, and Solved Leetcode Challenges
Tags: beginners, learning, javascript, webdev
Published: 2024-05-31 10:19:32

Hi everyone! Welcome back to another blog where I document the things I learned in web development. I do this because it helps retain the information and concepts as it is some sort of an active recall.

On days 33-35, I built a statistics calculator, a spreadsheet, and solved 3 leetcode challenges which are:

1. Recyclable & Low Fat Products (Python)
2. Defanging An IP Address
3. Jewels And Stones

In these projects, I learned advanced array methods, functional programming, and some python concepts, as well as some of its syntax. Also, my skills in data structures & algorithms have improved because of the leetcode challenges I solved despite being rated as easy.

As I worked more on my skills, I’m getting the hang of some concepts like array manipulation methods, such as `map()`, `reduce()`, and `filter()`.

In the statistics calculator project, if a user inputs a set of numbers, the program will calculate it according to each statistical value and output the respective answers. I gained experience in handling user input, DOM manipulation, and method chaining. I also practiced my skills by performing statistical calculations like range, variance, and standard deviation in an array of integers.

In the spreadsheet project, it’s literally just an excel spreadsheet where the user can input values in rows and columns and give them formulas to function. Although, my program is limited to these functions only: `sum, average, median, even, someeven, everyeven, firsttwo, lasttwo, has2, increment, random, range, and nodupes`. I also added an empty string for edge cases. Edge cases are situations where the code behaves differently than expected.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h7ibyrw8mfmxdo31yt59.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhwfuvmlrulghwbucz13.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26omk6c0e25p2tuy5c2a.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cj6ldaol4dmkixyrisuf.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sq50uzdcsg0p2towisrq.PNG)

I also learned minor things like a string that can be treated as an array because each character can be accessed with an index.

Another one is currying a function where it takes multiple arguments into a series of functions that only take one argument each. Here’s an example, I declare a function _addCharacters:_ `const addCharacters = character1 => character2 => num => {};`

The _addCharacters_ function has a function which takes _character1_ parameter and an inner function which takes _character2_ parameter that returns an empty function which takes a _num_ parameter. This can be done **many** times within a function (as long as it makes sense lol).

I also learned to put an underscore prefix on an unused parameter, as well as convert string to a floating-point number (which is a decimal).

Furthermore, I finally grasped how to use regular expressions. It goes like this: `Inside square brackets [ ]: Characters are treated literally, and special characters outside square brackets don't need to be escaped using . Only special characters inside square brackets need to be escaped.`

`Outside square brackets: Use \ to escape special characters or to give them special meaning, especially within parentheses ( ).`

Lastly, it’s my first time working with a function in an object. Here’s its syntax: `const myObject = {object1, object2, object3, objectFunction : (param) => {},};`

Pretty cool, huh?

Anyways, that’s all for now, more updates in my next blog! See you there!