Search the Community
Showing results for tags 'math'.
-
<script> function myFunction() { var a = Math.min(5, 10); var b = Math.min(0, 150, 30, 20, 38); var c = Math.min(-5, 10); var d = Math.min(-5, -10); var e = Math.min(1.5, 2.5); var x = a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e; document.getElementById("demo").innerHTML = x; } </script> What about adding something like one of the follow examples to show how to use the spread operator on an array with Math.min? var myArray = [0, 150, 30, 20, 38]; var f = Math.min(...myArray); or var f = [a, b, c, d, e]; var g = Math.min(...f);
-
- javascript
- math
-
(and 1 more)
Tagged with:
-
Hi, I saw following function: var banner = document.querySelector( '.stage div' ), a = 50, b = 50, c = 0; function sine(){ banner.style.top = a * Math.sin( start ) + b + 'px'; banner.style.left = c + "px"; c += 0.1; } window.setInterval( sine, 50 ); It is to make a sine motion in js; it works. Does anyone know the original equation of this in math that similar to: y = a sin c + b, x = c ? Thanks!
-
I want to get the value that is in the center between three values. For example: Math."middle"(34.78, 56.12, 45.54) Result in: 45.54 How I can do this?
-
I want to be able to use the current date to solve a math problem, specifically as follows:If today is March 17, the math problem of the day should be:(Month times Day of Month) + 99 = Answer of the Day(3 x 17) + 99 = 150How can I create a java script to find the current month and the current day of month, multiple those two together, then add 99 and display the answer as a result. Ideally I'd like to embed this into an existing simple html page by referencing the JavaScript "math problem" so when "index.html" is opened, I have a line that shows immediately: "The answer of the day is: X" (or 150 today, etc). Thank you -- JB
- 1 reply
-
- math
- javascript
-
(and 3 more)
Tagged with:
-
Hi all - I have searched the forums, tutorials and the web and I cannot find a good answer to this. I find plenty of HTML code for many math symbols, but I am specifically looking for one pictured (the long line) Thanks in advance for any help!
-
Hello Everyone, what could be the solution for this problem? $sa=0.15; $sb=1.30; echo $sa * 3;echo $sb * 3; result for $sa I get correct calculation of 0.45 but for $sb instead of 3.9 I get wrong calculation of 1.33.9. what can I do to fix this issue?