InterviewSolution
Saved Bookmarks
| 1. |
What are the different types of pop-up boxes in JavaScript? |
|
Answer» To RETURN the division remainder, use the Modulus operator in JavaScript. Let’s say the following are our two variables for which we want the modulus: var val1 = 20; var val2 = 8;Now, let us use the % operator to find the remainder: var RES = val1 % val2;The example finds the division remainder using the Modulus operator: <!DOCTYPE html> <html> <body> <h2>Remainder</h2> <p id="DEMO"></p> <script> var val1 = 20; var val2 = 8; var res = val1 % val2; document.getElementById("demo").innerHTML = res; </script> </body> </html>The output displays the remainder: |
|