Post-Lab Questions 4.1
1. A programming language is designed to be a human-readable (and -writeable!)
way to tell computers what to do. Programming languages allow us to give
computers instructions. Most computer scientists would agree that JavaScript is a
programming language, but many would not consider HTML one. Discuss one
similarity between JavaScript and HTML that suggests both might be
programming languages.
Discuss one difference between JavaScript and HTML that suggests only
JavaScript is a programming language.
- The similarities between JavaScript and HTML include the fact that both use tags, for example HTML will begin with the standard html tages and JavaScript begins with script language=javascript>.
The differences however are much more, HTML is not nearly as flexible as javascript is. The first reason that JavaScript is a lanugage is that to begin javascript, you must type script language=javascript, without this tag, javascript will not initiate.
2. Consider the concepts of input and output in the context of everyday devices. The
telephone takes input via its dialing buttons (or dial, if you have a rotary phone)
and the end of the handset you speak into. Phone output comes from the ringer
and the end of the handset you listen to. Consider each the following everyday
devices and describe their input and output as thoroughly as possible: television,
portable CD player.
- The television's input is via two main things, the electric cord which provides the energy and the RF cable is the way to put "information" into the TV. Via the RF cable, you can get the news, HBO, TNT, CartoonNetwork and other such programs to display.
For a CD Player, there are 3 main input sources. For its power, it calls on the batteries. For its "information" it depends on a CD actually being in the player. Finally, for its output, it will use the headphone jack and a means of getting the sound out.
3. Consider the short JavaScript program you work with in Parts 2 and 3 of this lab.
Does this program have input, output, both?
Describe the input and/or output.
How about the currency converter program? Does this program have input,
output, or both?
- Yes, both have inputs and outputs. The input for the javascript is the source code that we put in the browser via our notepad. The output is what will be displayed, in this example the alert message.
Currency converter programs have both inputs and outputs. They have 3 main parts. The first part is the input form where you will type what you want converted. When you type it in, it will process using the built in script, and lastly it will display your converted material.