Skip to content

Instantly share code, notes, and snippets.

@egoing
Last active February 5, 2022 06:36
Show Gist options
  • Save egoing/2641675b55e33caf6ae8cc9c08c83a45 to your computer and use it in GitHub Desktop.
Save egoing/2641675b55e33caf6ae8cc9c08c83a45 to your computer and use it in GitHub Desktop.
var vs let vs const
<script>
let 가격 = 10000;
const 부가가치세율 = 0.1;
let 부가가치세 = 가격 * 부가가치세율;
console.log(부가가치세);
</script>
<script>
// console.log(v0, l0); 선언 전에 접근 할 수 없다.
var v0 = 'v0';
let l0 = 'l0';
console.log(v0, l0);
// var v0 = 'v00';
// let l0 = 'l00';
function fn1(){
v0 = 'fn1-v0';
l0 = 'fn1-l0';
console.log(v0, l0);
}
fn1();
console.log(v0, l0);
function fn2(){
var v0 = 'fn2-v0';
let l0 = 'fn2-l0';
console.log(v0, l0);
}
fn2();
console.log(v0, l0);
{
var v0 = 'block-v0';
let l0 = 'block-l0';
console.log(v0, l0);
}
console.log(v0, l0);
var i = 'I';
for(var i=0; i<1; i++){
console.log(i);
}
console.log(i);
let j = 'J';
for(let j=0; j<1; j++){
console.log(j);
}
console.log(j);
</script>
@seohyundeveloper
Copy link

Thanks for your appreciation!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment