javascript

1.Given two values write a javascript programme to find out which one is nearest to 1001.


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
const closestTo100 =(a,b)=>(100-a)<(100-b)? a:b;

           console.log(closestTo100(20,25));
           console.log(closestTo100(10,33));
           console.log(closestTo100(98,-99));


</script>

</body>
</html>

Comments

Blogs

How To create a digital-clock in HTML CSS JavaScript

LightBox image Galery in html css and javaScript

Creating a clickable popup box with using html css and javascript