Created
August 25, 2018 05:11
-
-
Save mojaray2k/22f892c953c01a73630be98af6c2fd9a to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/diqumox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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