parseInt and parseFloat methods in javascript
parseInt and parseFloat methods in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test Page</title>
</head>
<body>
<!-- THIS EXAMPLE BASICALLY COVERS parseInt and parseFloat methods in javascript -->
<script type="text/javascript">
var first = " 22.5 metres tall he is";
var b = parseInt(first);
var c = parseFloat(first);
console.log(b); //this will return only the integer part
console.log(c); // this will return us the value along with decimals
</script>
</body>
</html>
Comments
Post a Comment
I WOULD APPRECIATE IF YOU LEAVE A COMMENT OR YOUR FEEDBACK HERE !!!