In the context of "nit: removed whitespace," I would assume that the term is short for nit-pick. That is, a small change that may not be very important, but is technically correct.
A program that reads your code and determines what it does and if it's grammar is valid
Where something sits physically in the code you write
A wrapper to help manage the code that is running
A name which maps to a unique value
A collection of name value pairs
Something that is accessible everywhere and to everything in your code
- One command at a time
- Programs have many lines of code but if they are single threaded they are only executing a line one at a time
One at a time and in order
Running a function (aka calling
a function)
- Where the variables live
- And how they relate to each other in memory
- Where a variable is availble in your code
- And if it's truly the same variable, or a new copy
- If you call the same function twice
- They each get their own Execution Context
- It looks like the same variable but it is two different variables in memory
- Also called EcmaScript 2015
More than one at a time
- This is filled with events and notifications of events that are happening
- When the browser, somewhere outside the JavaScript Engine has an event inside the JavaScript Engine we want to be notified of it gets placed on the Event Queue (aka
the queue
) - And if we have a function that can respond to that event we can listen for that event and have that function handle that event
- Either way the event gets placed on the queue
You don't tell the engine what type of data a variable holds, it figures it out while your code is running
You tell the engine ahead of time what type of data the variable will hold
- A type of data that represents a single value
- In other words, something that is not an object
- Undefined
- Null
- Boolean
- Number
- String
- Symbol (new)
undefined
represents a lack of existence- (you shouldn't set a variable to this)
- The JavaScript Engine initially sets variables to this value and it will stay
undefined
unless you set the variable to have a value
null
represents lack of existence- Developers should use this when setting a variable to not having a value
true or false
- Only one numeric type in JavaScript and it is called
Number
Number
is a Floating point number (meaning there is always some decimals)- Unlike other programming languages (they have
integer
,decimal
...), there is only onenumber
type... and that can make math weird
- A sequence of characters
- both single quotes
''
and double quotes can be used""
Used in ES6 - won't talk about it in this course
- A special function that is syntactically (written) differently
- Generally, operators take two parameters and return one result
- Which operator function gets called first
- Functions are called in order of precedence
- HIGHER precedence wins!
- What order operator functions get called in:
- Left-to-right (left associativity) or right-to-left (right associativity)
- When functions have the same precedence
- If my operators all have the same precedence how do I know what to do first?
- The associativity of that operator will tell me to call the functions left to right or right to left
- Converting a value from one type to another
- This happens often in JavaScript because it is dynamically typed
A grouping of JavaScript code that performs a task and is intended to be reusable
- Objects are collections of name/value pairs
- And those values can be other collections of name value pairs
- A container for variables and functions
- Typically to keep variables and functions with the same name separate
J
avaS
cript
O
bject
N
otation
- It is inspired by object literal syntax in JavaScript
- It looks a lot like object literal syntax
- A common misconception is to think they are the exact same thing
- Most fundamental Concept
- This is the difference between someone that uses JavaScript to someone that deeply understands it
- This is where we can learn to use JavaScript in ways that other popular programming languages can't match
In JavaScript, functions are Objects
Everything you can do with other types you can do with functions
A unit of code that results in a value
In JavaScript we have both Function Statements and Function Expressions
- An array is a collection
- It can hold many things inside of it
- The parameters you pass to a function
- JavaScript gives you a keyword of the same name which contains them all
- You could say:(same thing)
- Your parameters
- Your arguments
- This is the case with really any programming language that has functions
- But JavaScript gives you a keyword of that same name which contains them all
- We don't have to declare it anywhere
- It is automatically made available to you by the Execution Context
- Invisible characters that crate literal "space" in your written code
- Carriage returns
- tabs
- spaces
- Makes your code more human readable
- But that is really now what is being executed on the computer system
- The JavaScript syntax parser is very liberal about what it allows when it comes to whitespace
(pronouned if-ee)
Something that returns or makes other things for me
- Creating a copy of a function but with some preset parameters
- Very useful in mathematical situations
- JavaScript has less to do with languages like:
- Java
- C++
- More to do with languages like:
- Having first class functions inside JavaScript means we can use functional programming
- Where we think and code in terms of functions
- This introduces an entirely different way of thinking when programming
- It introduces an approach that is impossible to replicate in other programming languages
One object gets access to the properties and methods of another object
An object can look at itself, listing and changing its properties and methods
- One way to build objects
A normal function that is used to construct objects
- It starts its life as an empty object
- It is always there
- You can add on to it
- This is another way to create objects that does not try to mimick other programming languages
- New browsers all have built in
A different way to type something that doesn't change how it works under the hood
- array literal uses brackets []
- object literal uses curly braces {}
- JavaScript is liberal with how it parses code
- You can tell the JavaScript Engine to process your code in a strictor way
- It is written in JavaScript
- Deals with cross browser issues
- jQuery enables you to manipulate the DOM
- Document Object Model inside the browser
- Separate from the JavaScript Engine
- It is the thing that lets the browser look at the HTML and decide how to render
aka "paint"
it on the screen - JavaScript has access to the DOM
- It can manipulate the structure of an HTML page after its been loaded by manipulating the DOM in memory, which is a tree like structure that houses or stores a representation of your HTML that is used to paint or render onto the screen
- jQuery makes it easy to look at that tree (the DOM), to find things, to find elements on your page and manipulate them
- A whole other engine inside of jQuery
- link
- the string we passed jQuery
$('ul.people > li)
is using sizzle
- the string we passed jQuery
- I can have an IIFE nested inside another IIFE