C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Math exp() methodThe JavaScript math exp() method returns the exponential form of the given number i.e. ex. Here, x is the argument and e is the base of natural algorithms. SyntaxThe exp() method is represented by the following syntax: Math.exp(num) Parameternum - A number. ReturnThe number in the form of ex. JavaScript Math exp() method exampleHere, we will understand exp() method through various Example 1Let's see an example to print the given value in the form of ex. <script> document.writeln(Math.exp(1)+"<br>"); document.writeln(Math.exp(5)+"<br>"); document.writeln(Math.exp(-5)); </script> Output: 2.718281828459045 148.4131591025766 0.006737946999085467 Example 2Here, you can test exp() method with your own test cases. <script> function display() { var x=document.getElementById("num").value; document.getElementById("result").innerHTML=Math.exp(x); } </script> <form> Enter a number: <input type="text" id="num"> <input type="button" onclick="display()" value="submit"> </form> <p><span id="result"></span></p>
Next TopicJavaScript Math
|