Math.sinh() (Simulated functionality)

The sinh() function is not available in JavaScript but can be simulated to aid in the porting of existing code.

The example demonstrates how to add the sinh() method to the Math object.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <SCRIPT>
   // Add the sinh function to the Math object
   function sinh(aValue)
   {
   var myTerm1 = Math.pow(Math.E, aValue);
   var myTerm2 = Math.pow(Math.E, -aValue);
   
   return (myTerm1-myTerm2)/2;
   }
   // Register the new function
   Math.constructor.prototype.sinh = sinh;
   // Test the Math.sinh() method
   document.write(Math.sinh(2))
   document.write("<BR>")
   </SCRIPT>
   </BODY>
   </HTML>