CMPS 002 - Computer Literacy

Prof. Paulo Franca

CyberSlug Rules!

Classes

Class Syllabus

Grading Policy

Labs

Interact

Login

  • enter system
  • get attendance
  • submit work
  • take lab quiz
  • check scores

Help

Help me!

Links

Staff only

 

 

 

Datacare   Ahshay

 

Javascript:

Notice that:

  • Variables: you can use a name (no spaces) to designate a memory location where you want to store a number or a text string.
  • The equal sign: just like Fortran, the equal sign means "make this equal to"
  • window.prompt pops up a small window with a text. The text is what you have inside the parentheses. Whatever the user types in that window will be a result that can be assigned to a variable.

Sample program:

<script language="javascript">

firstName=window.prompt("What is your first name?");

lastName=window.prompt("What is  your last name?");

fullName=firstName+" "+lastName;

window.alert("Nice to meet you, "+fullName);

</script>

Try it!