- 1
Please help me to find mistake of this cod.What l will execute this functions same time?
function main() { var distance = parseInt(readLine(), 10); //ваш код }var distance=40; minut=590; minut1=60; let x=(minut /distance)*60; console .log(x); function test2 () { var distance = parseInt(readLine(), 10); }var distance =40; minut=100; minut1 =60; let y=(minut /distance)*60; console .log(y);
9 Antworten
- 2
I need a separate execute to do 2 functions
+ 2
no, you need to do all the test cases with the same 'main' generic function...
you doesn't have to hardcode the inputed distance ^^
just follow the hint wich describe what should occur for a distance of 150...
for distance = 150, output must be:
(150/40)*60
so, genericly, output must be::
(distance/40)*60
output this inside the 'main' function body, after the prefilled input assignement to the variable 'distance' ;)
+ 1
function main() {
var distance = parseInt(readLine(), 10);
//ваш код
} var distance=40;
minut=590;
let x=(minut/40)*60;
console .log(x);
function name ( ) {
var distance = parseInt(readLine(), 10);
} var distance=40;
minut=100;
let y=(minut/40)*60;
console .log(y);
0
What's the problem .
0
Thanks 👍👍👍
0
The code works as well.But l need to separate execute.
0
Separate outputs
0
you have only changed the name of the second function...
using a function to compute a value means calling it to get the value, and that function return the result after calling it: when tests run they expect that your main() function do the output...
as example, if the requirement was to add and log inputed number to 42, your function should look like:
function main() {
var number = parseInt(readLine(),10);
console.log(number+42);
}
nothing outside, generic solution inside to output the result of 42 plus any number got by input ^^
0
Thank you very much ❤️🥰