| Debate: Script or Program? |
| What is the difference between a programming language and a scripting language? Technically, JavaScript is scripting, not programming. Thus, its code is a script rather than a program. Generally, programming languages are more complex, require more specific instructions and definitions from the programmer, and are suitable for creating large, efficient applications. Scripting languages are "looser"-they require less discipline and complexity on the author's part, and are more suited to small tasks here and there. JavaScript borrows some from programming languages such as Pascal and C, and some from scripting languages such as Perl and REXX. Among the variety of programming and scripting languages around, JavaScript is one of the easier and less complex of them. |
var mugs = 2 var price = 9.95
var surname = "Caruthers" var model = 'C3PO'
var surname = caruthers
var married = true var dead = false
var variablename=null
| Stay Still |
| A constant is a label whose value never changes. A typical example from "the real world" is PI. We use the label "PI" or that funny symbol (), yet it always represents the same actual number. We may choose to use a similar technique in JavaScript programming, for ease of reading and ease of future program modifications. |
var price = 9.95 var total = mugs * price
var total = mugs * 9.95
object.property
| The New Math? |
| You may have noticed that you often start counting from 0 in programming. Why? The computer likes it that way. Therefore, in many computer counting scenarios, 0 represents "the first place," 1 is "the second place," and so on. It is somewhat confusing, which is why those who program frequently have the sort of hair that they do. In any case, it's just a matter of remembering that as you program. |
sweater.material sweater.size sweater.color sweater.price
sweater.material = "argyle" sweater.size = "M" sweater.color = "violet" sweater.price = 29.95
| For the Programmers Out There |
| If you've done any programming in the past, you may notice the similarity between objects in JavaScript and "arrays" in most other languages. That's no coincidence-they are the same thing. You can even refer to object properties in JavaScript in a more traditional array-like fashion, such as sweater["size"] = "M" |
![]() |
![]() |


