Home
A person can Vote or not using JavaScript
<script> function canVote(age) { if (age >= 18) { return " Eligible to vote. " ; } else { return " Not eligible to vote. " ; } } let …
A person can Vote or not using JavaScript Read MoreConditional Statement in JavaScript
<html> <body> <h3>Conditional using JavaScript child, teen, young,adult, old ,</h3> <p>Enter age: <input type="number" id="age"></p> <input type="button”"value="CLICK HERE" onclick=”"check()"/> <script> function check() { var ag=document.getElementById(‘age’).value; ag=parseInt(ag); if(Number.isInteger(ag)) { if (ag<=13) …
Conditional Statement in JavaScript Read MoreFibonacci Series using JavaScript
/*fibonacci series*/ <html> <head> </head> <body> <script> var a=0, b=1, c, i; var num=parseInt(prompt("Enter for limit")); for (i=1;i<=num;i++) { document.write("<br>" + a); c=a+b; a=b; b=c; } </script> </body> </html>
Fibonacci Series using JavaScript Read MoreGreatest among any three numbers using JavaScript
<html> <head> <script> function largestnum() { var num1, num2, num3; num1 = Number(document.getElementById("F").value); num2 = Number(document.getElementById("S").value); num3 = Number(document.getElementById("T").value); if(num1>num2 && num1>num3) { alert(num1+"-is greatest"); } else if(num2>num1 && num2>num3) …
Greatest among any three numbers using JavaScript Read Moredate using JavaScript
<!DOCTYPE html> <html> <body> <h2>Event</h2> <button onclick="document.getElementById(‘fordate’).innerHTML = Date()"> Click to display Date and Time.</button> <p id="fordate"></p> </body> </html> —————————————————————————————————————————————- <html> <body> <script type="text/javascript"> function displayDateTime() { var currentDate = …
date using JavaScript Read MoreEven or Odd using JavaScript
USING INPUT BOX <html> Number: <input type="number" id="number"> <br><br> Result: <input id="result" disabled> <br><br> <button onclick="checkEvenOdd()">Check Even/Odd</button> <script> function checkEvenOdd() { let number = parseInt(document.getElementById("number").value); if (number % 2 === …
Even or Odd using JavaScript Read MoreFactorial using JavaScript
<!DOCTYPE html> <html> <head> </head> <body style = "text-align: center; font-size: 20px;"> Enter a number: <input id = “num”> <br><br> <button onclick = "fact()"> Factorial </button> <p id = "res"></p> …
Factorial using JavaScript Read MoreCube using JavaScript
<html> <h1>CUBE using JavaScript</h1> <form> Enter No:<input type="text" id="number" name="number"/><br/> <input type="button" value="cube" onclick="getcube()"/> </form> <script type="text/javascript"> function getcube() { var number=document.getElementById("number").value; alert(number*number*number); } </script> </html>
Cube using JavaScript Read MoreArea of Circle using JavaScript
<html> <body> <script> function area(radius) { var area; area=Math.PI*radius*radius; return area; } </script> <form> enter the radius: <input type="text" name="radius"> <br> <br> Area <input type="text" name="result"> <input type="button" value="calculate" onclick="result.value=area(radius.value)"> …
Area of Circle using JavaScript Read More