Using a website called JS Bin (https://jsbin.com) i am trying to code a quadratic formula solver and when i run my code it returns this:
<script>try {function solve(a, b, c) {
var result = (-1 * b + Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a);
var result2 = (-1 * b - Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a);
return result + "<br>" + result2;
} catch (error) { throw error; }
here is the HTML:
<form> <input type="number" placeholder="A">
<input type="number" placeholder="B">
<input type="number" placeholder="C">
<textarea rows="10" cols="60" placeholder="Your Output">
and here is the Javascript:
function solve(a, b, c) {
var result = (-1 * b + Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a);
var result2 = (-1 * b - Math.sqrt(Math.pow(b, 2) - (4 * a * c))) / (2 * a);
return result + "<br>" + result2;
I tried to find an answer online but i did not find anything helpful, can anyone help me with this? i want the code to just produce the output of the javascript into the textarea.