Skip to content

Commit cce1a2d

Browse files
Update README.md
always define your variables at the top. defining them elsewhere is confusing because of hoisting. there is no block scope in javascript.
1 parent 95b6b5f commit cce1a2d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@
295295
}
296296
297297
// good
298+
var test;
298299
if (currentUser) {
299-
var test = function test() {
300+
test = function test() {
300301
console.log('Yup.');
301302
};
302303
}

0 commit comments

Comments
 (0)