+ 1
Pls can i get a better solution to this problem?
I want to console.log the result of 512-282 dividing 47.48+5 This is my code but i am not satisfied with it. var x= 512; var y=282; var z=x-y; var a =47.48; var b=5; var c= a+b; console.log(z/c). Pls i need other ways to make the code reusable
7 Antworten
+ 3
Here:
function myMathFunction(x,y,a,b){
console.log((x-y)/(a+b));
}
myMathFunction(512,282,47.48,5);
Simply call the function and enter your numbers as arguments in the correct order
https://code.sololearn.com/W8f3RAG4nqIU/?ref=app
+ 2
You can do the same thing with the line:
console.log((512-282)/(47.48+5));
But what do you want to be reusable?
+ 1
Thanks. Reusable in the sense that i want to be able to pass different values in it other times
+ 1
For each of the numbers
+ 1
This is perfect
+ 1
Thank u
0
Different values for each of the numbers or only for certain ones?