Skip to content

Instantly share code, notes, and snippets.

Created February 25, 2017 18:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/00923bfa592fabfed69251885c0ee3d3 to your computer and use it in GitHub Desktop.
Save anonymous/00923bfa592fabfed69251885c0ee3d3 to your computer and use it in GitHub Desktop.
let var const diff // source https://jsbin.com/tatinosano
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>let var const diff</title>
</head>
<body>
<script id="jsbin-javascript">
console.clear()
function callme(value) {
if (value == 'hi') {
var text = value;
// let text = value;
console.log(text + ' found');
}
if (value == 'hello') {
// const text = value;
console.log(text + ' found');
}
}
callme('hello')
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.clear()
function callme(value) {
if (value == 'hi') {
var text = value;
// let text = value;
console.log(text + ' found');
}
if (value == 'hello') {
// const text = value;
console.log(text + ' found');
}
}
callme('hello')</script></body>
</html>
console.clear()
function callme(value) {
if (value == 'hi') {
var text = value;
// let text = value;
console.log(text + ' found');
}
if (value == 'hello') {
// const text = value;
console.log(text + ' found');
}
}
callme('hello')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment