[DAY 33-35] I Built A Statistics Calculator, A Spreadsheet, and Solved Leetcode Challenges
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:
Recyclable & Low Fat Products (Python)
Defanging An IP Address
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.
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!