Recall the linear equation y mx b Complete the missing cod
Solution
Hi,
As given in the question we will calculate slope inside function and we will multiply with value and add b.
In the first line of function definition x is missing so we filled the dash with x and inside we calcultaed m and directly returning the value of y.
function linearEquation(mY,mX,b,x){
var m= mY/mX;
return (m*x)+b;
}
so when we call the function in the line :: var valA = linearEquation(mY,mX,b,x); we should pass the values to the function
and the last part add the return value to input tag will be by adding the below line after calling the function:
this the command in java script to fetch a item by its id and we will set a value to it. The id of the input tag is already given in the question as lineResult and the value will be returned by function and saved in valA.
Thank you and please comment below if you want any further clarification
