- 전체
- HTML
- Web Design (웹디자인)
- XE 응용 개발
- wordpress plugin dev
- Javascript & JavaScript Application
- MEAN Stack : full stack javascript
- angular js & ionic framework
- bootstrap
- WebGL, Three.js and Babylon.js
- restful api design
- mobile web
- node.js 응용
- Cloud Service 응용
- 웹 어셈블리 개발 [WASM, WebAssembly]
- 마이크로서비스, MSA (microservice architecture)
- WebGL / WebGPU
- next.js 개발
- micro frontend (마이크로프론트앤드)
- 전자상거래/쇼핑몰
- 서버 클라우드 (aws, azure, google)
JavaScript Javascript 문자열을 실수(부동소수점) 변수로 변환
2017.06.10 18:18
Javascript 문자열을 실수(부동소수점) 변수로 변환
Example
Parse different strings:
var a = parseFloat("10") + "<br>";
var b = parseFloat("10.00") + "<br>";
var c = parseFloat("10.33") + "<br>";
var d = parseFloat("34 45 66") + "<br>";
var e = parseFloat(" 60 ") + "<br>";
var f = parseFloat("40 years") + "<br>";
var g = parseFloat("He was 40") + "<br>";
var n = a + b + c + d + e + f + g;
The result of n will be:
10
10
10.33
34
60
40
NaN
Definition and Usage
The parseFloat() function parses a string and returns a floating point number.
This function determines if the first character in the specified string is a number. If it is, it parses the string until it reaches the end of the number, and returns the number as a number, not as a string.
Note: Only the first number in the string is returned!
Note: Leading and trailing spaces are allowed.
Note: If the first character cannot be converted to a number, parseFloat() returns NaN.
[출처] https://www.w3schools.com/jsref/jsref_parsefloat.asp
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 5 |
[REST API] REST API 이해하기
| 졸리운_곰 | 2018.01.21 | 346 |
| 4 | RESTful API를 설계하기 위한 디자인 팁 | 졸리운_곰 | 2018.01.21 | 528 |
| 3 |
REST API의 이해와 설계 #3 API 보안
| 졸리운_곰 | 2018.01.21 | 431 |
| 2 | REST API 이해와 설계 #2 API 설계 가이드 | 졸리운_곰 | 2018.01.21 | 71276 |
| 1 |
REST API의 이해와 설계 #1-개념 소개
| 졸리운_곰 | 2018.01.21 | 334 |

