How to Get Area of the Square using JavaScript
Submitted by alpha_luna on Wednesday, August 17, 2016 - 16:22.
In this article, we create a simple program and it’s called how to Get Area of the Square using JavaScript. How to run this program? It will ask the user to give the sides of the square and our program will compute to get the area of the square. You can also check the live demo of this simple article, so you can get an idea and you can try this out, let's start coding.
JavaScript
This script uses to solve the sides of the square to get the area.
This is the output:
Ask the user to give the sides of a square.
This is the area of a square:
This is a simple program and suited for the beginner. Kindly click the "Download Code" below for full source code.
If you are interested in programming, we have an example of programs that may help you even just in small ways.
Share us your thoughts and comments below. Thank you so much for dropping by and reading this article post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
- <script>
- var side = parseFloat(prompt("Enter the Side of the Square to Get the Area:"));
- var Solve_TheArea = (side * side);
- document.write("<br>");
- document.write("<h3 style='color:blue; text-align:center;'>How To Get Area Of The Square</h3><br><br>");
- document.write("<b style='color:blue; font-size:18px;'> The Sides of the Square is <b style='color:red;'>" + side + ".</b></b><br><br>");
- document.write("<b style='color:blue; font-size:18px;'> The Area of the Square is <b style='color:red;'>" + Solve_TheArea + ".</b></b>");
- </script>


Add new comment
- 47 views