Daily grind, Overthinking, and Resources

Welcome to all the new readers and followers! I'm so excited to have you on board.I know that learning to code can be challenging, but it's also incredibly rewarding. I've learned so much in the past few days and I'm loving every minute of it.

One of the most important things I've learned is that it's okay to make mistakes. In fact, making mistakes is one of the best ways to learn. Don't be afraid to try new things and experiment with different code. Even if you don't get it right the first time, you'll be one step closer to understanding the concept(not to mention all the ways to do a single thing. The other important thing I've learned is that it's important to not overthink things... anyway here is how i solved yesterday's task.

Yesterday, I was really struggling to figure out how to get the info from user input without using a button in the HTML. I tried a few different things, but nothing seemed to work. I had to use the number 1 tool for any developer...google. i ended up finding about the keydown event listener. This event listener is triggered when the user presses a key on the keyboard. I used this event listener to push() and pop() the value of the event.key into an array. **sigh** my code ended up being this...


let num = Number(event.key); // will change num variable into the value of the key pressed, make into a number

if (event.key === "Backspace") { // if the key pressed is strictly equal to the string "backspace"

    userNumArr.pop(); // pop off the last value of the array or backspace

    userInput() // run a later defined function

} else if (num >= 0 && num <= 9) { //the value of the num is a number that is 0-9

    userNumArr.push(num); // push the keypress into the array

    userInput() // run a later defined function

} else {

    event.preventDefault(); //ignore the keypress if its not already defined 

    userInput() //run a later defined function

});


get a better look on my github


What a good day:


Today was a really good day. I finished my unit conversion app and started learning how to use a database. I also started working on my new "resources" page. On the "resources" page. I'm going to include links to some of my favorite coding learning resources, as well as some helpful utilities. I hope that this page will be a valuable resource for other people who are learning to code or just want to find some cool tools.


Moral of the story:


Don't overthink it! Just write some code and try it out. You can use the typeof operator and console.log() to check your code as you go. I have been rocking lots of music while i code, here is a good one from "Neffex" if you need some motivation.


I hope you've found this blog post helpful. Please leave a comment below if you have any questions or feedback or drop me a message via the contact page

Comments

Popular posts from this blog

Scrimba, Unit Conversions, and Blog Updates