Skip to content

Commit

Permalink
JavaScript Basics
Browse files Browse the repository at this point in the history
Learned the rest of the basic data types and created a simple age calculator
  • Loading branch information
martkyle committed Feb 26, 2019
1 parent a87a4a6 commit 5c7511f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions basicJavaScript/ageCalc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Age Calculator</title>

</head>
<body>

<h1>Age Calculator</h1>

<p>Enter your age and find out how many days you've been alive!</p>

<script type="text/javascript" src="ageCalc.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions basicJavaScript/ageCalc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//Ask for the peron's age
var age = prompt("How old are you?");

var calcDays = age * 365.25;

alert(age + " years is roughly " + calcDays + " days");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5c7511f

Please sign in to comment.