Skip to content
Patricia Kruep edited this page Mar 10, 2015 · 2 revisions

Glossary

JavaScript terms and their definitions encountered during the workshop.

JavaScript

Statement

  • A statement is a complete instruction for the browser/UA to complete.
  • The end of a statement is marked with a semicolon.

Semicolon (;)

  • The semicolon operator marks the end of a statement.

Syntax

  • Syntax is the set of rules that describe how a language is written.

Expression

  • 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 of myValue falls between the values of minLimit and maxLimit.

Code block

  • Code blocks are defined by a pair of curly braces and contain one or more statements between the curly braces.

Operator

  • 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
  • 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

  • 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

  • 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.

Comment

  • 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.

Literal

  • A value that is literally placed in code and not the result of an expression.

String

  • 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.

Variable

  • 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.

Identifier

  • An identifier is a name
  • Typically used for variables and functions

Reserved Words

  • Identifiers reserved by JavaScript as keywords for the language itself or for possible future use in the language.

API

  • 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.

Document Object Model (DOM)

  • DOM is the interface JavaScript uses to access, manipulate, add, or remove HTML elements and their properties on a web page.

Loop

  • 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

Branch

Function

  • 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

Event

  • An event is an action, usually triggered by the user: mouse click, key press, focus on a link or form element, loading a page.

Event handler

  • 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.