Return To CS 100 Home

Colour Theme   Code Block Theme   Font Size Options
   
       
       
       
What Is A Variable?

What is a variable and how do I use it?

A variable is a placeholder that stores information. Variables can be used to store numbers, words, or sentences.

In order to use a variable in JavaScript, you have to give it a value from a textbox or other source.
<input type="text" id="inputbox">

You will then access what was put into that box by accessing the .value property of the box from it's ID
var stuffinbox = document.getElementById("inputbox").value;