Getting Started with Programming

We have learned how to do a few things now: make strings, find the length of strings, find what character is in the nth position, do basic math. Not bad for a day's work!

To do more complex coding, we need a way to 'save' the values from our coding. We do this by defining a variable with a specific, case-sensitive name. Once you create (or declare) a variable as having a particular name, you can then call up that value by typing the variable name.


var varName = data;


a. var myName = "Leng";
b. var myAge = 30;
c. var isOdd = true;


Create a variable called myAge and type in your age.

Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Remember to not use quotes, or your age will turn into a string. To declare a variable, you only need to type:

var variableName = /* some value */