DFTW - What is JavaScript?
DOM DOM DOM
It is time.
I have arrived.
The days of server side scripting with PHP are behind me.
In its place?
Client-side scripting with JavaScript.
I am bonafide Web Developer now?
Jokes aside, I’m not leaving PHP or server-side stuff completely in the dust, I’m mainly just improving what can be done with JavaScript.
So according to all-knowing Wikipedia JavaScript is “a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior”. - So basically it is a client-side language that runs well… on the client-side.
Side of the Client
Okay I know what your thinking… “yo you’ve said client-side 3 times already, you gonna tell me what that means??”
Yes, yes I will.
So just think of it this way, server-side orders a beer and then waits for the bartender so serve them; client-side orders a beer then the bartender hands them the tap to pour it themselves.
So in more nerdy terms -
Server side you:
ask → wait → get result
more controlled (usually requires to click a button before an action is taken)
have things happen before the page is sent to you
Client side you:
get result (no waiting to be served)
have things happen after the page loads
get to have things happen more dynamically
So let me give you a pretty clear example (PHP vs JS)
PHP filtering
Here in order to get filtered results I had to select the desired filters then click apply filter to actually get the results. Notice the website header though? Doing things this way create a link of filtered results that can be shared to whoever!
JavaScript filtering
Notice how there is no apply filter button here? The page just dynamically re-renders it contents based off the selected filter. Notice the website header here though? It does not change so no more sharing filtered results :( — a decidedly necessary sacrifice in this case.
Basically what is happening here is that PHP is having a conversation with the server and JavaScript is having one with the DOM.
DOM?
This is short for Document Object Model which is basically what the HTML is.
Visually represented:

So rather than the server the JavaScript code is mainly concerned with this stuff… until you get into stuff like node.js …but that’s for later!
Update
Hasn’t been long since my last post so nothing really - just mainly been working on some exercises from the exercises for programmers book (check em out here if so inclined)!




