[Home] [Growth Mindset] [What is Markdown?] [Coder’s Computer] [Revisions in the Cloud] [Getting Started With HTML] [CSS Beginner Basics] [Dynamic Web Pages With Javascript] [Computer Architecture and Logic] [Programming with JS] [Operators and Loops]
Discussion 7 Reading Notes
Pages 1-24
Examples of Javascript in a Web Browser
- Slideshows: Users can click through a slideshow or JS can enable slides to play automatically.
- Forms: Javascript can alert the user they are making a mistake or confirm they performed the function correctly.
- Relatding part of a page
- Filtering data
What Is a Script and How Do You Create One?
A script is a series of instructions like a recipe, handbook, or manual. Scripts are steps that the computer follows, and the scripts can respond to user input.
Writing a script starts with beginning with the end in mind. The user should:
- Define the goal
- Design the script
- Code each individual step in a way the computer understands (e.g., coding language)
Each individual task must be broken down into a sequence of steps. Flowcharts can be used to help visually display each step of the process.
Pages 74-79
The Basics of Expressions and Operators
Expressions may simply assign a value to a variable (e.g., var height = 6) or perform an operation such as var speed = 10 / 2. Expressions rely on operators. Operators can change values, perform mathemematical equations, concatenate strings, and other functions based on logic. Here are a few names and purposes of operators:
- Arithmetic Operator: Performs mathematical equations using code such as +, -, *, etc.
- Assigment Operator: Assigns a value to a variable (e.g., width = 24;)
- String Operator: The string operators (+) joins strings together. Note: You cannot mix a number and a string together. If you try to do this, the number simply becomes part of the string. The process of joining two or more strings together is called concatenation.
Pages 88-94
Functions
A function is a block of code that is meant to perform a specific task. Here are the basic steps in order to use a function:
- First, the function keyword must be used.
- Next, the user must give it a name and then write the statements in curly braces.
- Last the statement that performs the task will sit instide curly braces.
This process is called declaring a function. Once declared, the user can call the function to perform other tasks by simply naming the function in one line of code.
Source: Duckett, J. (2014). JavaScript & jQuery : Interactive front-end web development. Indianapolis, IN: John Wiley & Sons.