Chapter 1 - What is a Script? Flashcards
Writing a Script
Define a Goal Think of this as a puzzle Design the Script Split the goal into a series of tasks Code Each Step Write each step in JavaScript
Learning Javascript, we need to understand:
Vocabulary
The words that computers understand
Syntax
How to put these word together so the computer can follow them
Computers solve problems …….
Programmatically
A computer, working programmatically, would find the tallest person by…
Find the height of the first person
Assume they were the tallest person
Go through the others, comparing their height to the tallest person
If they are taller than the tallest person, they become the tallest person
At the end, you have the tallest person
A computer, working programmatically, would find cost of a plaque by…
Name is entered into the name field
Script triggered when show cost button is pressed
Script checks a value has been entered
If not, message tells user to enter name
If so, the script will calculate the cost by multiplying the cost per letter by the number of letters
The script displays the cost of the plaque
Flowcharts can help to plan tasks using
Generic step - Oblong
Event - Lozenge
Input or output - Wonky oblong
Decision - Diamond