14.2 Java script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

14.2 Java script

The current world record for high jumping is 2.45 meters. You are given a program that receives as input a number that represents the height of the jump. Task Complete the code to: 1. output to the console "new record" if the number is more than 2.45, 2. output to the console "not this time" in other cases. Sample Input 2.49 Sample Output new record var height = parseFloat(readLine(), 10) //your goes code here var height = 2.49; var height = 2.45; if (height > height) { alert("new record"); } else { alert("not this time"); }

24th Feb 2023, 2:39 PM
Kimmie J. Warden
Kimmie J. Warden - avatar
2 Answers
+ 2
Kimmie J. Warden You are declaring height 3 times. It's error. You can only once a variable. Task is "old_record height is 2.45'. And you are given an new height of input, take it as new_record . Compare it with old_record. If it is greater than old record then print "new record" Else "not this time". You need 2 different variables for old, and new input data. Then compare those two values. You are having single variable. And redeclaring, then comparing with itself. X
24th Feb 2023, 3:08 PM
Jayakrishna 🇮🇳
0
What is your question?
24th Feb 2023, 2:55 PM
I am offline
I am offline - avatar