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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![JAAFAR CHRAIBI](https://secure.gravatar.com/avatar/0e4e8e10800262080dd2d05ac1cd078d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
JAAFAR CHRAIBI
1,839 PointsWhat happens if i add a new "var" each time i want to change the value of the variable ?
?
4 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsA variable should only be declared once. If you use the keyword "var" on the same variable a second time, it is not proper programming. But duplicate variable declarations using "var" will not trigger an error, so you can "get away with it".
However, if you use the newer "let" keyword instead, it will cause an error.
![Dinesh P](https://uploads.teamtreehouse.com/production/profile-photos/11542603/micro_IMG_0005.jpg)
Dinesh P
415 PointsIt won't result in an error. But using var every time is just an extra work 😄
![ATIF IBAD KHAN](https://secure.gravatar.com/avatar/bd9b42b2f57e428336320a9875deedf0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ATIF IBAD KHAN
11,048 PointsUsing "var" for declaring variable again and again will not result in error, but note it will increase the size of javascript file.
Example:(Tested on windows 10):
var superhero = "Spider-Man"; superhero = "Venom"; The above content resulted in file-size of 51 bytes.
var superhero = "Spider-Man"; var superhero = "Venom"; The above content resulted in file-size of 55 bytes.
Extra 4 bytes will not cause much of issue, but if you adapt this practice and write large js files, then there will be a significant difference in file-size.
![Muhammad Khan](https://uploads.teamtreehouse.com/production/profile-photos/11550873/micro_IMG_0399.jpg)
Muhammad Khan
Courses Plus Student 8,772 PointsIn programing, it is not recommended to declare the same variable every time using 'var'. However, it does not give any error if you use 'var' again for the same variable but it's not a good practice.