Skip to content

Instantly share code, notes, and snippets.

@andreadardon
Created September 9, 2017 22:18
Show Gist options
  • Save andreadardon/f75377c8cbc85565f0997d5503ec01c2 to your computer and use it in GitHub Desktop.
Save andreadardon/f75377c8cbc85565f0997d5503ec01c2 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/dogiref
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
// First Exercise
var numOfKids = 3;
var partnersName = "John Smith";
var geoLocation = "San Francisco";
var jobTitle = "web developer";
var fortune = "You will be a" + " " + jobTitle +
" " + "in" + " "+ geoLocation +
", and married to" + " " + partnersName +
" " + "with" + " " + numOfKids + " " + "kids.";
console.log(fortune);
// Second Exercise
var birthYear = 1990;
var futureYear = 2020;
var oldestPossible = futureYear - birthYear;
var youngestPossible = oldestPossible - 1;
var result = "I will either be" + " " + oldestPossible + " " + "or" + " " + youngestPossible + " " + "in" + " " + futureYear;
console.log(result);
// Third Exercise
var currentAge = 26;
var maxAge = 100;
var amount = 5;
var yearsLeft = maxAge - currentAge;
var totalAmount = (amount * 365) * yearsLeft;
var result = "You will need" + " " + totalAmount + " " + "cups of coffee to last you until the ripe old age of" + " " + maxAge;
console.log(result)
// Fourth Exercise
var radius = 3;
// var diameter = radius * 2;
var circumference = 3.14 * 2 * radius;
var circumferenceResult = "The circumference is" + " " + circumference;
console.log(circumferenceResult);
var area = 3.14 * radius * radius;
var areaResult = "The area is" + " " + area;
console.log(areaResult);
// Fifth Exercise
var celsius = 40;
var convertCelsius = (celsius * 9)/5 + 32;
var resultF = celsius + "°C is" + " " + convertCelsius + " " + "°F";
var fahrenheit = 70;
var convertFahrenheit = ((fahrenheit - 32)*5)/9;
var resultC = fahrenheit + "°C is" + " " + convertFahrenheit + " " + "°C";
console.log(resultF);
console.log(resultC);
</script>
<script id="jsbin-source-javascript" type="text/javascript">
// First Exercise
var numOfKids = 3;
var partnersName = "John Smith";
var geoLocation = "San Francisco";
var jobTitle = "web developer";
var fortune = "You will be a" + " " + jobTitle +
" " + "in" + " "+ geoLocation +
", and married to" + " " + partnersName +
" " + "with" + " " + numOfKids + " " + "kids.";
console.log(fortune);
// Second Exercise
var birthYear = 1990;
var futureYear = 2020;
var oldestPossible = futureYear - birthYear;
var youngestPossible = oldestPossible - 1;
var result = "I will either be" + " " + oldestPossible + " " + "or" + " " + youngestPossible + " " + "in" + " " + futureYear;
console.log(result);
// Third Exercise
var currentAge = 26;
var maxAge = 100;
var amount = 5;
var yearsLeft = maxAge - currentAge;
var totalAmount = (amount * 365) * yearsLeft;
var result = "You will need" + " " + totalAmount + " " + "cups of coffee to last you until the ripe old age of" + " " + maxAge;
console.log(result)
// Fourth Exercise
var radius = 3;
// var diameter = radius * 2;
var circumference = 3.14 * 2 * radius;
var circumferenceResult = "The circumference is" + " " + circumference;
console.log(circumferenceResult);
var area = 3.14 * radius * radius;
var areaResult = "The area is" + " " + area;
console.log(areaResult);
// Fifth Exercise
var celsius = 40;
var convertCelsius = (celsius * 9)/5 + 32;
var resultF = celsius + "°C is" + " " + convertCelsius + " " + "°F";
var fahrenheit = 70;
var convertFahrenheit = ((fahrenheit - 32)*5)/9;
var resultC = fahrenheit + "°C is" + " " + convertFahrenheit + " " + "°C";
console.log(resultF);
console.log(resultC);
</script></body>
</html>
// First Exercise
var numOfKids = 3;
var partnersName = "John Smith";
var geoLocation = "San Francisco";
var jobTitle = "web developer";
var fortune = "You will be a" + " " + jobTitle +
" " + "in" + " "+ geoLocation +
", and married to" + " " + partnersName +
" " + "with" + " " + numOfKids + " " + "kids.";
console.log(fortune);
// Second Exercise
var birthYear = 1990;
var futureYear = 2020;
var oldestPossible = futureYear - birthYear;
var youngestPossible = oldestPossible - 1;
var result = "I will either be" + " " + oldestPossible + " " + "or" + " " + youngestPossible + " " + "in" + " " + futureYear;
console.log(result);
// Third Exercise
var currentAge = 26;
var maxAge = 100;
var amount = 5;
var yearsLeft = maxAge - currentAge;
var totalAmount = (amount * 365) * yearsLeft;
var result = "You will need" + " " + totalAmount + " " + "cups of coffee to last you until the ripe old age of" + " " + maxAge;
console.log(result)
// Fourth Exercise
var radius = 3;
// var diameter = radius * 2;
var circumference = 3.14 * 2 * radius;
var circumferenceResult = "The circumference is" + " " + circumference;
console.log(circumferenceResult);
var area = 3.14 * radius * radius;
var areaResult = "The area is" + " " + area;
console.log(areaResult);
// Fifth Exercise
var celsius = 40;
var convertCelsius = (celsius * 9)/5 + 32;
var resultF = celsius + "°C is" + " " + convertCelsius + " " + "°F";
var fahrenheit = 70;
var convertFahrenheit = ((fahrenheit - 32)*5)/9;
var resultC = fahrenheit + "°C is" + " " + convertFahrenheit + " " + "°C";
console.log(resultF);
console.log(resultC);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment