Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
martkyle committed Feb 26, 2019
2 parents 8df5850 + 5c7511f commit a210b6a
Show file tree
Hide file tree
Showing 6 changed files with 64 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");
13 changes: 13 additions & 0 deletions basicJavaScript/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Script Demo</title>
<script type="text/javascript" src="stalker.js"></script>
</head>
<body>
<h1>Including JS Files</h1>



</body>
</html>
3 changes: 3 additions & 0 deletions basicJavaScript/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var userName = prompt("What is your name?");
alert("Nice to meet you, " + userName);
console.log("Also great to meet you " + userName);
19 changes: 19 additions & 0 deletions basicJavaScript/stalker.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>JS Basics</title>
<script type="text/javascript" src="stalker.js"></script>
</head>
<body>
<h1>JS Stalker Exercise</h1>
<p>Variables, Strings, Prompt, and Console.log</p>
<ul>
<li>Ask for the user's first name</li>
<li>Ask for the user's last name</li>
<li>Ask for the user's age</li>
<li>Print out the user's full name in a sentence</li>
<li>Print out the user's age in a sentence</li>
</ul>

</body>
</html>
8 changes: 8 additions & 0 deletions basicJavaScript/stalker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var firstName = prompt("What is your first name?");
var lastName = prompt("What is your last name?");
var age = prompt("What is your age?");

var fullName = firstName + " " + lastName;

console.log("Your full name is " + fullName);
console.log("You are " + age + " years old");

0 comments on commit a210b6a

Please sign in to comment.