Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Please how can I create a variable named myAge and assign it a number value

Please how can I create a variable named myAge and assign it a number value

3 Answers

var myAge = 12; or latest version Javascript you can use let and const instead of var. example: let myAge = 12;

It didn't work

What exactly did you try? Can you show your code? Please provide some context?

Maybe there was something before that? was it var myName = 'your name';

and then you add under it var myAge = ?

var myAge = 13; let myAge = 13; const myAge = 13;