코드:
결과보기 »
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>JavaScript Number Method</title> </head> <body> <h1>Number.parseFloat() 메소드</h1> <script> document.write(Number.parseFloat("12") + "<br>"); // 12 document.write(Number.parseFloat("12.34") + "<br>"); // 12.34 document.write(Number.parseFloat("12문자열") + "<br>"); // 12 document.write(Number.parseFloat("12 34 56") + "<br>"); // 12 document.write(Number.parseFloat("문자열 56")); // NaN </script> </body> </html>