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

How to set a backslash in javascript?

How can I set a variable equal to a forwardslash, aka the division operator? Any time I set the operator equal to a variable, it messes with the rest of my code. I don't want the operator set as a string value, I want it set as the operator value. How can I achieve this?

Stone Preston
Stone Preston
42,016 Points

just curious...why would you want to do this?

2 Answers

George S-T
George S-T
6,624 Points

Title is a little confusing. Java is a totally different language to JavaScript.

Stone Preston
Stone Preston
42,016 Points

you are saying you want to set a variable equal to the division operator? so when you reference the variable you really mean "put the division operator here"? why not just use the division operator.