Skip to content
Snippets Groups Projects
Commit 325973aa authored by Stefan Dierauf's avatar Stefan Dierauf
Browse files

moar slides

parent 6e9b7f0f
No related branches found
No related tags found
No related merge requests found
## Javascript example #1
Some simple DOM manipulation
```javascript
// Grab every div on the page
var divs = document.querySelectorAll("div");
// Loop through each element
for (var i = 0; i < divs.length; i++) {
// Change the background image
divs[i].style.backgroundImage =
"url('http://stfn.me/stefchat/stefchatweb.jpg')";
}
```
\ No newline at end of file
## Javascript Example #2
First class functions!!
```javascript
function englishHello(name) {
console.log("Hello " + name);
}
function swedishHello(name) {
console.log("Hej " + name);
}
var cse333 = swedishHello;
function helloCaller(name, helloFunction) {
helloFunction(name);
}
helloCaller("Brendan Eich", englishHello);
helloCaller("Grace Hopper", swedishHello);
helloCaller("Abraham Lincoln", cse333);
```
<pre>
Hello Brendan Eich
Hej Grace Hopper
Hej Abraham Lincoln</pre>
## Javascript to the rescue
* Designed in 10 days by Brendan Eich
* @see <a href="https://www.destroyallsoftware.com/talks/wat">Wat by Gary Bernhardt</a>
* Dynamic typing
* First class functions
* **Event loop**
* **Non-blocking I/O**
// Grab every div on the page
var divs = document.querySelectorAll("div");
// Loop through each element
for (var i = 0; i < divs.length; i++) {
// Change the background image
divs[i].style.backgroundImage = "url('http://stfn.me/stefchat/stefchatweb.jpg')";
}
function englishHello(name) {
console.log("Hello " + name);
}
function swedishHello(name) {
console.log("Hej " + name);
}
function helloCaller(name, helloFunction) {
helloFunction(name);
}
helloCaller("Brendan Eich", englishHello);
helloCaller("Grace Hopper", swedishHello);
\ No newline at end of file
[
"nodejs.md",
"who-is-this-kid.md",
"outline.md"
"outline.md",
"what-even-is-node.md",
"problem-background.md",
"javascript-to-the-rescue.md",
"javascript-ex1.md",
"javascript-ex2.md"
]
\ No newline at end of file
## The Problem
* Single thread synchronous I/O
* Cool! Totally works and easy to think about
* Multithread synchronous I/O
* OH NOES
* Scaling, concurrency, etc
\ No newline at end of file
## What even *is* node?
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment