On Javascript
Old school way (that's still pretty popular)
Webserver (which just serves up pages)
+
Language (e.g. PHP or ASP) — i.e. a web-specific language
"LAMP STACK"
New school way
All in one
e.g. Python's Django
or
Node/Node.js
Why YET ANOTHER LANGUAGE?
It's a good question. Data storage and retrieval is hard.
The 800lb gorilla.
Because
First to market. That's pretty much it.
"Because we need interactivity on the web right now, and anything’s better than Flash."
“I was writing something that could be used by people who didn’t know what a compiler was.
They were just going to load it.
“It was like Basic. That was really the pitch….”
“I was under marketing orders to make it look like Java but not make it too big for its britches.
It’s just this sort of silly little brother language, right? The sidekick to Java.”
(primarily)
Client- Side Language.
Meaning, the BROWSER does the work.
Arbitrary, executable code in your browser, all the time.
SO- in PHP (and other server side languages)
- The computer hosting the website does the work.
In Javascript?
- Your computer, the one viewing the website, does the work.
- Weakly/Dynamically typed
- end statements with a semicolon. Or dont.
- One number type; a 64 bit “double”
Doesn’t have “Classes,” but can have “Prototypes - “
Basically, a creator function with lots of “this” going on.
In practice:
Instructions (scripts) on an HTML page that get executed on connection.
But the scripts don’t replace themselves like in PHP, they send instructions to modify other parts of the page as needed.
This is done via the DOM, the Document Object Model.
Very similar to how we specified things in CSS, (e.g. tags) except in a “tree” format.
Also:
JavaScript Object Notation or:
JSON-
An increasingly popular text data storage format that can do mostly what XML does. Not bad actually. Inspired even easier ones like YAML.
Yes, I think. Almost out of necessity.
But just about EVERYTHING has been replicated, rewritten.
Not only can you theoretically do everything in Javascript, a lot of it is literally "there."
So much so, it's hard to keep up with.
Also, lots of transpiling and other languages etc. etc.