-
Notifications
You must be signed in to change notification settings - Fork 0
Glossary
Patricia Kruep edited this page Mar 10, 2015
·
2 revisions
JavaScript terms and their definitions encountered during the workshop.
- JavaScript is a programming language commonly used around the web.
- Most browsers support JavaScript, as do a number of other programs and platforms.
- JavaScript typically interprets each line of code is read and executed as the user agent or interpreter gets to it.
- JavaScript relies on its host environment (commonly the web browser) to provide means for input and output.
- The W3C gives a short history of JavaScript: https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript
- DailyJS goes into further detail with their History of JavaScript articles: http://dailyjs.com/history-of-javascript.html
- Mozilla Developer Network (MDN) offers an overview to the JavaScript language: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Introduction#What_is_JavaScript.3F
- A statement is a complete instruction for the browser/UA to complete.
- The end of a statement is marked with a semicolon.
- The semicolon operator marks the end of a statement.
- Syntax is the set of rules that describe how a language is written.
- A phrase of JavaScript that can be evaluated to produce a value.
- A variable is an example of a simple expression. It is evaluated to whatever value the variable holds.
-
((myValue < maxLimit) && (myValue > minLimit))is an example of a complex expression. This particular one evaluates whether or not the value ofmyValuefalls between the values ofminLimitandmaxLimit.
- Code blocks are defined by a pair of curly braces and contain one or more statements between the curly braces.
- Operators are symbols or keywords JS uses to evaluate or manipulate data.
- Assignment operator
- The
=sign, roughly in the middle of the statement, is called the ‘assignment operator’ - The assignment operator is one of many operators in the JS language, also part of the syntax
- The
- Arithmetic operators
- Addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). Modulus returns the remainder from a division expression.
- Conditional operators
- Greater than (>), less than (<), equal to (==), not equal to (!=), greater than or equal to (>=), less than or equal to (<=), identical to (===), not identical to (!==)
- MDN offers this article on Expressions and Operators: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators
- Case sensitivity refers to how an interpreter reads and evaluates a character.
- JavaScript is case sensitive: it treats uppercase and lowercase letters as different characters.
- A is not the same as a
- White space are the non-printing characters like spaces, tabs, and new lines.
- For the most part, JavaScript ignores these characters
- We use white space to enhance and clarify the readability and understandability of our code.
- Comments are lines of code ignored by the JavaScript interpreter
- Line comments in JavaScript begin with a
//. Everything the right of the//is ignored by the interpreter. - Block comments are bracketed by the
/*and*/(just like in CSS!). Everything between the/*and*/is ignored by the interpreter.
- A value that is literally placed in code and not the result of an expression.
- Strings are one of three primitive data types in JS. Numbers and booleans (true/false) are the other two.
- Strings are characters captured between a pair of double quotes or a pair of single quotes.
- Like letter beads strung on a string.
- They’re sort of like atoms or “primary” colors. The primitive data types can’t be made from anything else.
- A variable is a means of storing a piece of data in memory and giving it a name so we can refer to it elsewhere in the program.
- The var keyword tells JS that we are creating a variable. We declare the variable to JS.
- The variable name is a unique identifier with some syntax rules.
- a-z, A-Z, 0-9
- _, $ allowed
- dashes not appreciated
- First character must be a letter or $
- Case sensitive
- Where ever we need the data in the variable, we insert the variable name.
- Whenever we need to, we can change the value contained in a variable by assigning a new value to the variable.
- An identifier is a name
- Typically used for variables and functions
- Identifiers reserved by JavaScript as keywords for the language itself or for possible future use in the language.
- Application Programming Interface
- A set of programming 'hooks' or methods to access a program or service
- For example: Twitter's API allows developers to make custom apps without knowing the inner workings of the Twitter service.
- Modern web browsers have APIs that expose the contents of a web page for JavaScript to access.
- DOM is the interface JavaScript uses to access, manipulate, add, or remove HTML elements and their properties on a web page.
- A means of repeating code until a condition can no longer be met
- Three types of loops in JavaScript:
- while() loop (while this condition is true, repeat this code)
- do..while() loop (repeat this code while this condition is true)
- for() loop (initialize a counter, check the counter against a limit, increment the counter; repeat the code until the counter reaches the limit)
- MDN has this article on loops: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration
- A branch is fork in the program's road where the program chooses a path based on a condition being met.
- Branches are created using if(), if()..else statements.
- MDN has this article on branching and conditional statemnets: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Control_flow_and_error_handling#Conditional_statements (also contains information on other JavaScript control structures).
- A function is a block of code written once and stored in memory while the program is running.
- Functions are declared using the function keyword, frequently followed by the name of the function.
- Naming rules same as for variables
- Functions can receive data values for use within the function and can return data back to where the function was called.
- MDN on functions: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions
- An event is an action, usually triggered by the user: mouse click, key press, focus on a link or form element, loading a page.
- An event handler is an instruction to JS to ‘listen’ for a particular event to happen. JS has further instructions for what to do when it ‘hears’ the event happen.