Test

    Cards (35)

    • JavaScript
      A programming language that is both wonderful and horrible for beginners to learn
    • JavaScript
      • You can build almost anything with it and get a job anywhere if you master it
      • It's weird, ugly, and surrounded by a dystopian Wasteland of Frameworks and libraries
    • JavaScript was created in 1993 by Brendan Ike at Netscape
    • At the time, the web browser was cutting edge technology that connected everybody on the planet via the World Wide Web
    • Websites were completely static with pure HTML, so JavaScript was designed as an easy to use high level language to help developers make these websites interactive
    • JavaScript is arguably the most popular language in the world and its standard implementation is called ecmascript and is the default language in all web browsers
    • JavaScript is the only code that natively runs in a browser aside from webassembly
    • JavaScript can also be run on a server thanks to tools like node.js and Dino
    • Scripting language
      Code can be executed on the Fly by opening up the console in your browser Dev tools to run some code that changes the appearance of a website at any time
    • Interpreted
      Code is executed line by line as opposed to other languages like C that are compiled ahead of time
    • Under the hood of the browser there's an engine called V8 that makes JavaScript run extremely fast by taking your code and converting it to machine code with a process called Just in Time compilation
    • Using JavaScript on a web page
      1. Have an HTML document
      2. Include a script tag
      3. Write code inside the tag directly or reference an external file with the source attribute
      4. Use console log to print to the standard output
    • Variables
      Can be defined using let, const, or var
    • let
      • Most common way to define variables today
      • Dynamically typed language, no data type annotations needed
      • Can be reassigned later
    • const
      • Used for variables that cannot be reassigned later
    • var
      • The original way to declare a variable, but should be ignored
    • Lexical environment
      Determines where variables work and where they don't (global scope, local function scope, block scope)
    • Functions
      One of the main building blocks in JavaScript<|>Can take input arguments and optionally return a value<|>Are just objects, can be used as Expressions
    • this keyword
      • References an object, based on how a function is called (global scope, object, manually bound)
    • Arrow functions
      • Don't have their own this value, always Anonymous, ideal for function Expressions
    • Primitive vs Object
      Primitives are passed by value, objects are passed by reference
    • Objects
      Defined with object literal syntax or constructor<|>Contain key-value pairs<|>Inherit properties from prototypes
    • Classes
      Syntactic sugar for prototypal inheritance and objects<|>Define a Constructor, properties, Getters/Setters, and static methods
    • Data structures
      Arrays, Sets, Maps, and more
    • Garbage collection

      Automatically deallocates objects from memory when they're no longer referenced
    • Event Loop
      Allows writing asynchronous code that runs in a separate thread pool while the rest of the application continues to execute
    • Asynchronous code
      1. Use setTimeout for a simple example
      2. Callbacks can lead to callback hell
      3. Promises provide a better way to handle asynchronous code
      4. Async/await syntax makes asynchronous code more readable
    • Modules
      Allow sharing code between files, with default exports and named exports
    • npm
      The largest JavaScript package manager, downloads code into the node_modules folder
    • Web development with JavaScript
      1. Use the Document Object Model to interact with HTML elements
      2. Listen to events and update the UI accordingly
      3. Front-end Frameworks provide declarative, reactive UI updates
    • Module bundlers
      Tools like Veet or webpack that combine multiple JavaScript files into a single bundle for the browser
    • Node.js
      Allows executing JavaScript code on the server
    • Electron
      Combines Node.js with a browser to create full stack desktop apps with JavaScript
    • React Native
      Allows creating iOS and Android apps with JavaScript
    • If you want to make life easier, use a tool like TypeScript or ESLint that does static analysis to improve your code quality
    See similar decks