Home  >  Article  >  Web Front-end  >  JS code to convert a string into a numerical value and round it_javascript skills

JS code to convert a string into a numerical value and round it_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:02:40919browse

Core code:

Copy code The code is as follows:

var result = '3.1415926' | 0; // 3


Test code:


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn