일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- 강의 #느낀점 #snowfox #스노우폭스 #김승호회장
- hackerrank #python #algorithm #해커랭크 #파이썬 #알고리즘
- TIL #Today I Learned # 기록 # 회고 #Udemy
- #TIL #Today I Learned #기록 #회고 #ternary statement #swich statement #스위치 반복문 #
- javascript #event #onclick #js
- 고스트 블로그 #
- TIL #Today I Learned #
- javascript #statement #expression #difference
- 웹페이지제작 #
- 기록 #회고
- 불리언 #Boolean #number #string #symbol #null #undefined
- Hackerrank #해커랭크 #python #파이썬 #알고리즘 #Algorithm
- 자바스크립트 #javascript #datatype #데이터타입 #자료형
- 블로그 셀프제작
- javascript '===' #javascript #TIL #Today I Learned #기록 #회고
- single source of truth란 #single source of truth #자료의중복 #자료의비정합성 #비정합성 #리팩토링
- 블로그만들기 #웹사이트만들기 #
- Today
- Total
목록2019/12/22 (3)
well-balanced
Today I Learned 클로저 함수에 대해 좀 더 알아보았다.
Today I Learned Hackerrank에 있는 JavaScript 문제를 몇가지 풀어봤다. 이곳에 정리했다. 클로저에 대해서 이해하려고 노력중이다. 일단 그 중에 꽤나 자주 쓰이는(?) Classic한 예제를 이해하는데 성공했다. var arr = [] for(var i=0; i { return i } } for(var index in arr) { console.log(arr[index]()) } 이 코드의 결과는 0, 1, 2, 3, 4 가 출력될 거라는 내 예상과는 다르게 아래와 같았다. 그 이유는 i가 return된 scope에는 변수 i에 대한 선언이 없기 때문에 그 상위 scope의 전역변수 i 값인 5를 참조했기 때문이다. i 변수를 var가 아닌 let으로 선언한다면 어떻게 될까? ..
Problem [ Day 2: Loops | HackerRank Learn For, While and Do-While loops in Javascript. www.hackerrank.com ](https://www.hackerrank.com/challenges/js10-loops/problem) function vowelsAndConsonants(s) { const vowels = ['a','e','i','o','u'] for (var i of s) { if(vowels.includes(i)){ console.log(i) } } for (i of s) { if(!vowels.includes(i)){ console.log(i) } } ..