Skip to content

Instantly share code, notes, and snippets.

@mojaray2k
Created August 25, 2018 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojaray2k/22f892c953c01a73630be98af6c2fd9a to your computer and use it in GitHub Desktop.
Save mojaray2k/22f892c953c01a73630be98af6c2fd9a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/diqumox
<!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">
// Using ES5 approach
function getMessage() {
const year = new Date().getFullYear();
return "The year is " + year;
}
console.log(getMessage());
// Using ES6 approach with Template Strings
function getLiteralMessage() {
const year = new Date().getFullYear();
return `The year is ${year}`;
}
console.log(getMessage());
</script>
<script id="jsbin-source-javascript" type="text/javascript">// Using ES5 approach
function getMessage() {
const year = new Date().getFullYear();
return "The year is " + year;
}
console.log(getMessage());
// Using ES6 approach with Template Strings
function getLiteralMessage() {
const year = new Date().getFullYear();
return `The year is ${year}`;
}
console.log(getMessage());
</script></body>
</html>
// Using ES5 approach
function getMessage() {
const year = new Date().getFullYear();
return "The year is " + year;
}
console.log(getMessage());
// Using ES6 approach with Template Strings
function getLiteralMessage() {
const year = new Date().getFullYear();
return `The year is ${year}`;
}
console.log(getMessage());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment