JavaScript JavaScript Basics Working With Numbers Using Math Methods

Javier Castañeda
Javier Castañeda
2,374 Points

hello: I think that the correct answer is alert(Math.trunc(temperature) ); but i can´t find the mistake thank

hello: I think that the correct answer is alert(Math.trunc(temperature) );

but i can´t find the mistake thank

script.js
var temperature = 37.5;


alert(Math.round(temperature) );
alert(Math.trunc(temperature) );
index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

1 Answer

Javier Castañeda
Javier Castañeda
2,374 Points

alert(Math.trunc(temperature) );

i find the mistake

Math.floor it´s the solution