Bem-vindo ao JavaScript Tutorial
Previous topic/Tópico anterior
Next topic/Próximo tópico
03 - Basic example, variable manipulation

To show a popup with the result of a calculation.


<html>
<body>

<script>

a = 2
b = 9
c = a + b

alert(c)

</script>

</body>
</html>
Here we have variable manipulation, like the traditional math.

Understanding the code:

a = 2
Makes the a variable receive number 2.

b = 9
Makes the b variable receive number 9.

c = a + b
Makes the c variable receive the result of a + b.

alert(c)
Makes the window to display the content of the c variable. Note that we don't use quotes before and after c because we want the code to show the value of the variable. If we put quotes, it would only show the letter c, literally.

Previous topic/Tópico anterior
Next topic/Próximo tópico
[ Voltar ]


© 2005 JavaScript Tutorial Brasil
Proibida a cópia ou distribuição integral ou parcial não-autorizada
Unauthorized integral or partial distribution or reproduction is forbidden
Patrocínio - Assistência Técnica de Calculadoras HP CSCenter