nicolewhite / algebra.js

Build, display, and solve algebraic equations.
http://algebra.js.org
MIT License
1.34k stars 111 forks source link

ReferenceError: Expression is not defined #63

Closed saurabhvyas closed 8 years ago

saurabhvyas commented 8 years ago

I just downloaded algebra.min.js and referenced it in my index.html file then I tried one of the examples from your website but I keep getting this error on firefox

here is my index.html

<!DOCTYPE html>

<head>

    <meta charset="utf-8"/>

<script src="algebra.min.js" >  </script>

<script src="test.js" >  </script>

<title> Err. Interrupter </title>

</head>

<body>

<h1> Err. Interrupter </h1>

<h2> What is 2x + 3 = 5 ? </h2>

</body>

<script>

</script>

</html>
nicolewhite commented 8 years ago

What is in test.js?

saurabhvyas commented 8 years ago

console.log('test'); just this

nicolewhite commented 8 years ago

I don't see where you reference Expression, then. :(

saurabhvyas commented 8 years ago

I am sorry Here is the code again

<!DOCTYPE html>

<head>

    <meta charset="utf-8"/>

<script src="algebra-0.2.5.min(1).js"></script>

err I am getting :
![capture2](https://cloud.githubusercontent.com/assets/6899784/17942222/254cdac6-6a54-11e6-8cc6-4407676365a7.PNG)

<script>

var expr = new Expression("x");
expr = expr.subtract(3);
expr = expr.add("x");

console.log(expr.toString());

</script>

<title> Err. Interrupter </title>

</head>

<body>

<h2> What is 2x + 3 = 5 ? </h2>

</body>

</html>

My folder structure looks something like this : capture

err I am getting
capture2

nicolewhite commented 8 years ago

You need to define Expression. Try adding var Expression = algebra.Expression.

saurabhvyas commented 8 years ago

Okay algebra.Expression solved the problem It would be great if can update the docs so other users dont face similar problem

nicolewhite commented 8 years ago

It is in the documentation. Thanks!