Skip to content

Instantly share code, notes, and snippets.

View gracefullight's full-sized avatar
👍

Eunkwang Shin gracefullight

👍
View GitHub Profile
@gracefullight
gracefullight / global-variables-are-bad.js
Last active February 17, 2021 10:06 — forked from hallettj/global-variables-are-bad.js
How and why to avoid global variables in JavaScript
// var 로 내부 변수를 선언해야합니다.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// 그렇지 않으면 전역변수로 선언됩니다.
(function() {
foo = 'Hello, world!';
print(foo) //=> Hello, world!