Eloquent Javascript Chapter Two Exercise 1.0

In this example below you will see how to do a Eloquent Javascript Chapter Two Exercise 1.0 with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by udus97, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright udus97 ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Eloquent Javascript Chapter Two Exercise 1.0</title>
  
  
  
  
  
</head>

<body>

  <h1>Eloquent Javascript</h1>
<h2>This Pen contains solutions to the "Minimum" exercise at the end of Chapter two in the book Eloquent JS by Marijn Haverbeke </h2>
<h3>Problem</h3>
<p>The previous chapter introduced the standard function Math.min that returns its smallest argument. We can do that ourselves now. Write a
function min that takes two arguments and returns their minimum.</p>


<p>The solution is in the JS pane of this pen. Tests values can be run and the result can be viewed in the console.</p>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/udus97/eloquent-javascript-chapter-two-exercise-10-WXMzrb */
function min(first, second) {
  if (first < second) return first;
  return second;
}

console.log(min(41,5));
console.log(min(1,5));
console.log(min(-1,5));

Comments