describe('root', function () {
beforeEach(() => {
console.log('๋ก ์ฒ ์์')
startApp()
})
afterEach(() => {
console.log('๋ก ์ฒ ์ข
๋ฃ')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let z = 1; | |
| function *foo() { | |
| const x = yield 2; | |
| z++ | |
| const y = yield (x*z) | |
| console.log(x, y, z) | |
| } | |
| const it_first = foo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const bookmark = '.btn_important.on' | |
| const interval = setInterval(function () { | |
| const items = document.querySelectorAll('.mail_item') | |
| for (const item of items) { | |
| if (item.querySelector(bookmark) == null) item.querySelector('#mCk').click() | |
| } | |
| document.querySelector('.btn_del').click() | |
| if ( | |
| document.querySelector('.info_none') != null || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchMachine = Machine({ | |
| initial: 'idle', | |
| states: { | |
| idle: { | |
| on: { | |
| SUBMIT: 'submit', | |
| }, | |
| }, | |
| submit: { | |
| on: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fib(n) { | |
| let first = 1, second = 0; | |
| let current; | |
| for (let i = 2; i <= n; i++) { | |
| current = first + second | |
| second = first | |
| first = current | |
| } | |
| return current | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function nextPermutation(A: number[]) { | |
| let i = A.length - 1 | |
| let j = A.length - 1 | |
| while (i > 0 && A[i - 1] >= A[i]) i -= 1 | |
| if (i === 0) return false | |
| while (A[j] <= A[i - 1]) j -= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function strToint(string: string) { | |
| let i = 0; | |
| let num = 0; | |
| let isNeg = false; | |
| const length = string.length; | |
| const zeroCode = '0'.charCodeAt(0); | |
| if (string[0] === '-') { | |
| isNeg = true; | |
| i = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isEqual = <T extends number | string>(first: T[], second: T[]) => | |
| first.length === second.length && | |
| first.findIndex((item, index) => item !== second[index]) === -1; | |
| const isEqualVariableArray = <T>(...arrays: T[][]) => arrays.slice(0, arrays.length - 1).findIndex((array, index) => !isEqual<T>(array, arrays[index+1])) | |
| console.assert(isEqualVariableArray<number>([1, 2], [1, 2], [1, 2])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function selectionSort(array: number[]) { | |
| for (let last = array.length - 1; last > 0; last--) { | |
| const largest = array.slice(0, last + 1).sort()[last]; | |
| const largestIndex = array.findIndex((item) => item === largest); | |
| array[largestIndex] = array[last]; | |
| array[last] = largest; | |
| } | |
| return array; | |
| } |
์ ์ ์คํฌ๋ฆฝํธ์์ ์๋น์ค ์ ์๊น์ง
์ฃผ๋์ด ์ธํฐ๋ ์ ๋ง๋ฒ์ฌ. ์ ๋นํ ๋ฒ์ ๊ด๋ฆฌ ํ๋ก๊ทธ๋จ์ ์ฐพ๋ค๊ฐ ๊น(Git)์ ๋ค๋ฃจ๊ฒ ๋๋ฉด์ ํ๋ก๊ทธ๋๋ฐ์ ํ์ฐ์ ์ผ๋ก ์์ํ๋ค.
์ ํ๊ธฐ๋ง๋ค ์ด๋ค ์ฌ์ด๋ ํ๋ก์ ํธ๋ฅผ ์งํํ ์ง ์ฌ๊ฐํ๊ฒ ๊ณ ๋ฏผ์ ํ๊ณ ์๋ค.