Home > syntax error > how to fix syntax error in javascript

How To Fix Syntax Error In Javascript

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site logic error About Us Learn more about Stack Overflow the company Business Learn more about syntax error in programming hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join semantic error the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How do I fix syntax error javascript this syntax error? up vote 2 down vote favorite The code is: function roundAmount(theDecimal) { var s = "" + Math.round(theDecimal * 100) / 100 var i = s.indexOf('.') if (i < 0) { return s + ".00" } var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3) if (i + 2 == s.length) t += "0" return t } The

Math Error

line with the error: if (i < 0) return s + ".00" The error is: error: expected (;) does anyone know how to fix this? javascript syntax-error share|improve this question edited Jul 23 '09 at 17:33 Brandon 48.3k22140184 asked Jul 23 '09 at 17:13 problem_bringer121 oh by the way the laguage is java script thanks –problem_bringer121 Jul 23 '09 at 17:15 a semi-colon missing shouldn't matter in javascript –Brian Ramsay Jul 23 '09 at 17:17 that line is fine. Error must be somewhere else. I think it might be one line above perhaps. Need to see more code... –Jimmy Chandra Jul 23 '09 at 17:17 4 Is this the type of question that we should just answer by fixing the question? i.e. "My problem was that I wrote {this}, but I really should have written {that}" where {this} is his original stuff and {that} is the "correct" answer. –Erich Mirabal Jul 23 '09 at 17:18 1

 

© Copyright 2019|winbytes.org.