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
Jenna Malone
7,173 PointsShould there be quotes around the numbers?
Ok so the first object he made he didn't put ' ' single quotes around the numbers but for the rest of the objects he did. Anyone know which way is correct?
Example
{name: "Jenna", Track: "Front End Development", Achievements: 100, Points: 1000},
{name: "David", Track: "Computer Science", Achievements: '5', Points: '2'},```
2 Answers
andren
28,558 PointsWhen you put quotes around something it makes it a string. Strings are used to represent text, and while you can type numbers into a string it will still be considered a form of text.
So when you want to reference something that is not text, be it a number or anything else you should not use quotes.
Ivan Bagaric
Courses Plus Student 12,356 Pointsthe first one is correct, but if you have number between quotes you can use parseInt later on when you using it