hello
Possible to calculate mathematical expression like 2x(square)+3x+1 using javascript? any link i refer to perform mathematical calculations? and example

Member Avatar for langsor

hello
Possible to calculate mathematical expression like 2x(square)+3x+1 using javascript? any link i refer to perform mathematical calculations? and example

Besides basic math, there are built-in functions as well ...
http://www.javascripter.net/faq/mathfunc.htm
http://www.techotopia.com/index.php/JavaScript_Math_Object
http://www.javascriptkit.com/javatutors/math.shtml

Something like ... although my non-scripting math is pretty sad really

var x = 41;
var answer = Math.sqrt( 2 * x ) + 3 * x + 1;
alert ( answer );

Hope it helps :-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.