What's wrong with javascript code -


Text after "

When you run this code in the console, it works fine, but not working like this - < / p>

it works on the console -

  function solveEquation () {// format ax + c = var Eql = "3x + 5 years = 4", // equation 1 eq2 = "5x + 6y = 2 by", // equation 2 // different ax, by & amp; C eq1Parts = eq1.split (/ [\ + \ - \ =] /), eq2Parts = eq2.split (/ [\ + \ - \ =] /), // A, B & amp get value, ca. 1 = parseInt (eq1Parts [0]), B 1 = parseInt (eq1Parts [1]), C 1 = parseInt (eq1Parts [2]), A2 = parseInt (eq2Parts [0]), B 2 = parseInt (eq2Parts [1 ]), C 2 = parseInt (eq2Parts [2]), // substitution and elimination // https://www.khanacademy.org/math/algebra/systems-of-eq-and-ineq/fast-systems-of -equations / e / systems_of_equations B1 = B1 * A2, C1 = C1 * A2, B2 = B2 * A 1, C 2 = C2 * A 1, 1 A 1 and A 2 exit There is no need to specify them, // unknown y = (C1 - C2) / (B1 - B2), X = (C1 - B1 * Y) / A1; // Enter the value of y in the equation, 1 ansContainer.textContent = "x =" + x + ", y =" + y; }  

I know that this is a cart code, this is a very early stage and I got stuck.

After the

You are divided by zero.

  var eq1Container = document.getElementById ( "input-eq1"), eq2Container = document.getElementById ( "input-A 1"), & Lt; - Reference Equal Input  

Comments