Day Posted February 19, 2015 Share Posted February 19, 2015 I'm trying to create an equation and would prefer not to split it into different variables. Is there a way to divide twice on the same line and avoid created a regular expression? example: var eq = (5/5)/(5+5); Thanks, Link to comment Share on other sites More sharing options...
Ingolme Posted February 19, 2015 Share Posted February 19, 2015 Yes, as long as on both sides of the / there's a number it will be interpretted as a division. The code you show here works. Link to comment Share on other sites More sharing options...
Day Posted February 20, 2015 Author Share Posted February 20, 2015 Oh I didn't test it (I should have) I just assumed I was doing something wrong when it got color coded as a regular expression. Link to comment Share on other sites More sharing options...
Ingolme Posted February 20, 2015 Share Posted February 20, 2015 I think leaving spaces between the slashes should prevent the editor from being confused. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now