Skip to main content

My last day of work and hoping it's a beginning of something new

It was my last day of work and I'm happy I finished my remaining tasks on time. And now, it's time for me to move on to my next journey. The only reason I took the job was for me to get enough experience to build my own app. So I already planned it that I will quit my job after 3 years since I signed the 3-year bond contract.  Didn't know that it was tough having one source of income but I think I'm good since I'm still living with my parents... There are times that I compare my income and life to my coworkers, same age brackets and shit... which resulted for me to lose my focus and my mind shifted a lot of times, and I think it's a waste of time to repeat it again. But... at the end of the day... I'm just too lazy I guess and I think that a day job is not suited for me. I'm more of the build one app and make it rain type of guy... Don't even know what to do now!!! I guess I'll try playing stocks and multiplying my money while trying to build my

What is the DOM and how does it work?

    What is the DOM and how does it work? | by Noobie Programmer

I've been asked to teach about the DOM... but first and foremost what is the DOM?

Is it when you are angry and you say DOMmit!!! hehe Or

Is it your friend DOMinick???

Well kidding aside, the DOM just stands for Document Object Model (πŸ˜…Sorry for joking but please continue reading the article - there are javascript examples below in codepen ).

Browser is taking the HTML sent from the server and converting it to the DOM. so the browser is based on the DOM and not on the html and everytime we edit the dom using javascript it gets reflected on the screen.

Is the browser's internal programmatic representation of the web page. Which basically means one thing, you can manipulate the web page using the dom. and how do we do it? of course by using our favorite language, JAVASCRIPT!

Since the dom is more or less an object in javascript, it contains several function to access, modify and delete certain elements. If you are familiar with jquery and this one liner code here like: document.querySelect("body")

then you are already using the dom. 

This is important because at some point maybe we wanna animate something that even css can't do or just listen to events, delete some buttons etc. the possibilities our endless when we use the power of dom and javascript together.

For example you might want to add a class for all the html elements that you want to show/remove everytime you click the toggle button (and remember this is plain old javascript):

See the Pen Toggle hide class name using vanilla javascript by Noobie Programmer (@noobieprogrammer) on CodePen.

And sometimes you want to create a list of data and you might want to add an input box try this:

See the Pen Javascript - add elements using plain old javascript by Noobie Programmer (@noobieprogrammer) on CodePen.

Ever heard of jquery? it's a javascript library to manipulate the DOM easier. let's try to remake the two first code above using jquery with less code:

See the Pen bGpMyyp by Noobie Programmer (@noobieprogrammer) on CodePen.

It's reactive right? that's why it's so powerful and why also react and other frameworks uses it to update pages on html. 

Also, if you are using certain frameworks like ReactJS put in mind that most of the time you are updating the virtual DOM which they created so that the developers will produce an even less buggy code since many things can go wrong when updating the DOM.

Going back to the basics strengthens your foundation.


If you like to learn more, buy the best book for learning javascript: https://amzn.to/3hOnqUW

Loving the article?  Then please follow:

πŸ‘‰ Youtube

πŸ‘‰ Twitter

πŸ‘‰ Instagram

to keep you up to date with my new tutorials!!! πŸ’“πŸ’“πŸ’“


Resources: 

Comments

Post a Comment

Popular posts from this blog

Flutter: How to create an error alert or popup notification with SnackBar

There are 3rd party libraries out there that offer alerts or popups in Flutter. But, what I'll be teaching you today is how to use the built in SnackBar widget to produce an error popup or notification easily. For the video version of the tutorial go here:  How to use snackbar in flutter as error alert or popup notification To use the SnackBar widget and make a nice Snack Bar that you see in most google apps like youtube, all you need to do is wrap your entire app with the Scaffold Widget. So let's make create a new file page_wrapper.dart and create a new Widget named PageWrapper that accepts a widget as children. After that all we need to do is call the PageWrapper widget in all of our pages so that we have a base widget that uses the Scaffold in every page. This means we can now use the SnackBar on every page. In the main.dart all you need to do is this: Then now we can create the home page and create a snackbar. Before that we need a trigger

My last day of work and hoping it's a beginning of something new

It was my last day of work and I'm happy I finished my remaining tasks on time. And now, it's time for me to move on to my next journey. The only reason I took the job was for me to get enough experience to build my own app. So I already planned it that I will quit my job after 3 years since I signed the 3-year bond contract.  Didn't know that it was tough having one source of income but I think I'm good since I'm still living with my parents... There are times that I compare my income and life to my coworkers, same age brackets and shit... which resulted for me to lose my focus and my mind shifted a lot of times, and I think it's a waste of time to repeat it again. But... at the end of the day... I'm just too lazy I guess and I think that a day job is not suited for me. I'm more of the build one app and make it rain type of guy... Don't even know what to do now!!! I guess I'll try playing stocks and multiplying my money while trying to build my