Description

변수 str에 저장된 문자열을 실수로 변환해서 pi_float에 저장하세요.


문자열을 실수로 변환하기 위해 parseFloat를 이용할 수 있습니다.
parseFloat는 명령어 뒤에 따라오는 괄호의 문자열 앞에서부터 Number를 인식합니다. 아래의 예를 참고하여 문제를 해결해 보세요.

var height = "160.4";
console.log(height, typeof(height));    // 160.4 string이 출력됩니다.

var height_int = parseInt(height);
console.log(height_int, typeof(height_int));    // 160 'number'가 출력됩니다.

var height_float = parseFloat(height);
console.log(height_float, typeof(height_float));    // 160.4 'number'가 출력됩니다.
  • You need to fill in the blank with the appropriate code.
  • You cannot modify the given code.
  • An error message will appear in the result if you leave the blank empty.
Result Stop
Result of [Run Test] or [Submit] will be displayed here
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.