Math.cosec() (Simulated functionality)

The cosec() 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 cosec() method to the Math object.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <SCRIPT>
   // Add the cosec function to the Math object
   function cosec(aValue)
   {
   return 1/Math.sin(aValue);
   }
   // Register the new function
   Math.constructor.prototype.cosec = cosec;
   // Test the Math.cosec() method
   document.write(Math.cosec(2))
   document.write("<BR>")
   </SCRIPT>
   </BODY>
   </HTML>

See also:Math.cot(), Math.sec()