Fireship · @fireship

The JavaScript Survival Guide

Uploaded July 15, 2019 · Length 14:47

The JavaScript Survival Guide

Summary

This video teaches the fundamental concepts of JavaScript programming, including how to run code, primitive types, control flow, and error handling, to help developers survive the language's weirder parts.

  • javascript survival guide
  • javascript fundamentals
  • javascript programming
  • javascript basics
  • javascript control flow
  • javascript error handling

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    some people call javascript a virus and

  2. 0:02

    if that's true it means developers are

  3. 0:04

    the host no matter what you label

  4. 0:05

    yourself ads today you have to face the

  5. 0:07

    reality that one day you may join the

  6. 0:09

    hordes of JavaScript developers out

  7. 0:10

    there and when that day comes you need

  8. 0:12

    to be prepared by understanding the

  9. 0:14

    practical fundamental concepts of the

  10. 0:15

    JavaScript programming language today's

  11. 0:17

    video is not about victory it's about

  12. 0:19

    survival welcome to episode 3 of the

  13. 0:26

    full JavaScript course in the last video

  14. 0:28

    we looked at how JavaScript works under

  15. 0:29

    the hood and today we'll look at many of

  16. 0:31

    the fundamental features of the language

  17. 0:32

    as they relate to practical programming

  18. 0:34

    but more importantly I want to help you

  19. 0:36

    survive some of the weirder parts of

  20. 0:37

    JavaScript that might trip you up or

  21. 0:39

    that you might find on an interview

  22. 0:40

    question and many of these concepts like

  23. 0:42

    closures and hoisting can be easily

  24. 0:44

    understood by removing the head or

  25. 0:46

    destroying the brain

  26. 0:50

    chapter 1 where and how do I run my

  27. 0:53

    JavaScript code let's find out by

  28. 0:54

    creating a hello world app open up an

  29. 0:56

    editor like vs code create a file called

  30. 0:58

    index J s and type in console.log hello

  31. 1:02

    world now assuming you have no js'

  32. 1:04

    installed you can run the script

  33. 1:05

    directly on your machine via the command

  34. 1:07

    line we'll have an entire video

  35. 1:08

    dedicated to node.js later in the course

  36. 1:10

    but all you need to know for right now

  37. 1:12

    is that if you type in node index J s in

  38. 1:14

    the command line it will execute the

  39. 1:16

    code in your script so you just wrote a

  40. 1:18

    back-end server side JavaScript

  41. 1:19

    application but when most people think

  42. 1:21

    about J s they're thinking about

  43. 1:22

    browsers and web applications it's

  44. 1:25

    possible to run code in the browser just

  45. 1:26

    like we did from the command line by

  46. 1:28

    opening the developer console in the

  47. 1:30

    previous video we learned that

  48. 1:31

    javascript has an interpreter or JIT

  49. 1:33

    compiler to be precise that will execute

  50. 1:35

    your code when you type it in here but

  51. 1:36

    the browser console is really just a

  52. 1:38

    debugging tool the way that web

  53. 1:40

    applications actually work is they

  54. 1:41

    declare a script tag in an HTML document

  55. 1:43

    we can go ahead and create an index.html

  56. 1:45

    file then we'll add a script tag and set

  57. 1:48

    the source attribute to the JavaScript

  58. 1:50

    file when the browser parses this HTML

  59. 1:53

    file it's going to see the script tag

  60. 1:54

    and then try to load and execute the

  61. 1:56

    script in our case it won't execute the

  62. 1:58

    JavaScript until the document is fully