Skip to content

Instantly share code, notes, and snippets.

Created November 11, 2015 22:44
Show Gist options
  • Select an option

  • Save anonymous/5c709a0209f04243768d to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/5c709a0209f04243768d to your computer and use it in GitHub Desktop.
So Last Year Function Complete // source http://jsbin.com/hedifo
<!DOCTYPE html>
<html>
<head>
<title>So Last Year Function Complete</title>
</head>
<body>
<script id="jsbin-javascript">
/*
So Last Year Function
Directions: Make a program that tells you the grade and age you were last year
Instructions:
1. Declare a function called lastYear.
2. Give the function a parameter named year.
3. In the body of the function, make a return statement that subtracts one from the parameter.
4. Create two console.log statements.
4a. one statement should print the grade you were in last year
4b. one statement should print the age you were in last year
*/
//Write your code on the next line
function lastYear(year){
return year - 1;
}
console.log("Last year was the year " + lastYear(2015));
console.log("Last year I was in the " + lastYear(11) + "th grade");
</script>
<script id="jsbin-source-html" type="text/html">
<!DOCTYPE html>
<html>
<head>
<title>So Last Year Function Complete</title>
</head>
<body>
</body>
</html>
</script>
<script id="jsbin-source-javascript" type="text/javascript">/*
So Last Year Function
Directions: Make a program that tells you the grade and age you were last year
Instructions:
1. Declare a function called lastYear.
2. Give the function a parameter named year.
3. In the body of the function, make a return statement that subtracts one from the parameter.
4. Create two console.log statements.
4a. one statement should print the grade you were in last year
4b. one statement should print the age you were in last year
*/
//Write your code on the next line
function lastYear(year){
return year - 1;
}
console.log("Last year was the year " + lastYear(2015));
console.log("Last year I was in the " + lastYear(11) + "th grade");</script></body>
</html>
/*
So Last Year Function
Directions: Make a program that tells you the grade and age you were last year
Instructions:
1. Declare a function called lastYear.
2. Give the function a parameter named year.
3. In the body of the function, make a return statement that subtracts one from the parameter.
4. Create two console.log statements.
4a. one statement should print the grade you were in last year
4b. one statement should print the age you were in last year
*/
//Write your code on the next line
function lastYear(year){
return year - 1;
}
console.log("Last year was the year " + lastYear(2015));
console.log("Last year I was in the " + lastYear(11) + "th grade");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment