Application Security Testing: An Integral Part of DevOps
- The initial character must be a letter, an underscore, or a dollar sign, but subsequent characters may be numbers as well.
- No spaces are allowed.
- Variables are case sensitive, so my_cat is different from My_Cat, which in turn is different from mY_cAt. As far as the computer is concerned, each of these would represent a different variable--even if that's not what the programmer intended. (You'll see an example of this in the section 'alert()' on page 22.) To avoid any potential problems with capitalization, I use lowercase for all my variables, with underscores (_) where there would be spaces in ordinary English.
Arithmetic with VariablesLine Y in Figure 2-3 introduces a new variable called seconds_per_day and sets it equal to the product of the other three variables using an asterisk (*), which means multiplication. A plus sign (+) for addition, a minus sign (-) for subtraction, and a slash (/) for division represent the other major arithmetic functions.
<h1>Know how many seconds are in a day?</h1> <h2>I do!</h2>So now you have a page that knows how many seconds there are in a day. Big deal, right? Wouldn't it be better if you could tell your visitors what the answer is? Well, you can, and it's not very hard.
Line-by-Line Analysis of Figure 2-4Line X in Figure 2-4 writes the words there are to the web page (only the words between the quote marks appear on the page). Don't worry about all the periods and what window and document really mean right now (I'll cover these topics in depth in Chapter 4, when we talk about image swaps). For now, just remember that if you want to write something to a web page, use window.document.write("whatever");, placing the text you want written to the page between the quotes. If you don't use quotes around your text, as in
IT Solutions Builder
TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Mobile Security Networks/IoT Cloud Data Storage Applications Development IT Management Other Searching our resource database to find your matches...
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Searching our resource database to find your matches...