- 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);

30th May 2021, 12:08 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
9 Answers
- 2
I need a separate execute to do 2 functions
30th May 2021, 12:16 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
+ 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' ;)
30th May 2021, 4:38 PM
visph
visph - avatar
+ 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);
31st May 2021, 7:10 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
0
What's the problem .
30th May 2021, 12:13 PM
Dark_Mix
Dark_Mix - avatar
0
Thanks šŸ‘šŸ‘šŸ‘
30th May 2021, 5:09 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
0
The code works as well.But l need to separate execute.
31st May 2021, 7:15 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
0
Separate outputs
31st May 2021, 7:16 PM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar
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 ^^
31st May 2021, 7:25 PM
visph
visph - avatar
0
Thank you very much ā¤ļøšŸ„°
1st Jun 2021, 8:24 AM
Syuzi Ghazaryan
Syuzi Ghazaryan - avatar