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 trialRobert O'Toole
6,366 Pointsrandom question but related to this.
just wondering if we use these shorthand signs (+=, -=, /=. *=) with variables or strings that aren't numbers later on..
in other words are these shorthand ways of adding, subtracting, multiplying, and dividing from a variable only possible using number values?
4 Answers
Jamie Reardon
Treehouse Project ReviewerWith the += sign, you can also concatenate (or combine) strings to a variable.
var message = 'Hello ';
message += 'there, nice to see you';
Robert O'Toole
6,366 Pointsyes but can u do it with -= and *= and '= later with certain types of vars?
Jamie Reardon
Treehouse Project ReviewerI don't believe you can, I mean, logically thinking about without any experience trying that out, you would think that you can't as they are mathematical related, especially the divide and multiply operators. You could try to experiment with the -=
operator by trying to subtract a specific string value from a string related variable.
Here is a list of the assignment operators and some examples
Hopefully someone with more experience can reply for you.
Robert O'Toole
6,366 Pointsthanks man. yeah i know what ur saying.. just wondering if way down the line with certain specific types of variable u cud in fact multiple one variable by another and they not consist of numbers. only a week into Javascript and the possibilities literally seem endless
gotta try to stay with the present material tho! haha
Jamie Reardon
Treehouse Project ReviewerThat is true, wait till you see properties and methods :) in fact, what you can do is use the length property on string variables and use the arithmetic operators on them to return a value but that would be a numeric value.
Robert O'Toole
6,366 Pointsdid u start your learning on Javascript? ive been working at this for about 2 months and learned everything so far in the front end development course. so basically alot of html and css and now this javascrip stuff. i just was wondering where your at now with a job in this field and current interest? i see u have earned a lot of badges and just curious about people's journey with programming coding.
Jamie Reardon
Treehouse Project ReviewerI started learning with treehouse as a pro student in november 2018, following front end material (html, css). I joined the techdegree of the front end web Development in april 2019 (to present). I picked up JavaScript there where I am currently still learning it but have a good core understanding of it now. I have 2 units left in the curriculum.