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

javascript calculator

any one help me this replace function here

 if(operators.indexOf(lastChar) > -1 || lastChar == '.')
equation = equation.replace(/.$/, '');

or visit to see full code here on line 30 or 31 http://code.runnable.com/VJBJAB4wFlc2tdun/javascript-css3-calculator

Can you be more specific about what you need? Very nice code by the way

  • You define lastChar twice - on line 24 and 52
  • Also I think replace is no longer used. Its replaced with replaceWith =)

i m learning to make calculator with this code but i m unable to get line 30 or line 31 mention in above link

I'm sorry but I don't understand the problem. Everything seems to work. What are you checking here?