Log
-
[TOEFL/Writing] Question 1 : Sea otter
The writer and the lecturer argued about sea otter populations problems. The writer mentioned sea otter populations are declining because of pollution, and the lecturer has a different interpretation of the writer's evidence. First, the writer said that pollution like oil rigs and industrial chemicals are a cause of the declining sea otter populations. Consequently, pollution makes sea otters h..
2025.05.24 07:46 -
[30 Days of JS] Interval Cancellation / Promise Time Limit
/** * @param {Function} fn * @param {Array} args * @param {number} t * @return {Function} */var cancellable = function(fn, args, t) { fn(...args); const intervalId = setInterval(() => { fn(...args); }, t); return () => clearInterval(intervalId);};/** * const result = []; * * const fn = (x) => x * 2; * const args = [4], t = 35, cancelTimeMs = 190; * * const start = performance.now(); *..
2025.05.18 10:41 -
[30 Days of JS] Sleep / Timeout Cancellation
/** * @param {number} millis * @return {Promise} */async function sleep(millis) { return new Promise(resolve => setTimeout(resolve, millis));}setTimeout : makes delay(callback, delayTime) : callback - 딜레이 후 실행시킬 함수 / delayTime - 얼마나 딜레이 시킬 것인가/** * @param {Function} fn * @param {Array} args * @param {number} t * @return {Function} */var cancellable = function(fn, args, t) { const timeoutId..
2025.05.15 10:54 -
[Github] CLI로 Push 하기
VSCode 터미널 열기 : ctrl + `Branch 없이 Main에서 Push 하는 경우git add .git commit -m "Your descriptive commit message"git push origin main
2025.05.15 06:55 -
[30 Days of JS] Memoize / Add two promises
/** * @param {Function} fn * @return {Function} */function memoize(fn) { const cache = new Map(); return function (...args) { const key = JSON.stringify(args); if (cache.has(key)) { return cache.get(key); } const result = fn(...args); cache.set(key, result); return result; };}Map()input으로 들어온 것들을 pair로 만들어서 순서대로 기억하도록 만들어 줌JSON.string..
2025.05.14 09:13 -
[TOEFL/Writing] Question 1 : Discussion of smart cars
My WritingSmart cars are continuously communicating with a centered-control system and dribe themselves using a lot of sensors. However, a new technology always has some problems and the writer and lecturer are discussing the pros and cons of smart cars. First, the writer argued that smart cars can prevent accidents with a lot of sensors. These sensors can measure most things: distance between c..
2025.05.12 23:32 -
[30 Days of JS] Return length of arguments passed /
/** * @param {...(null|boolean|number|string|Array|Object)} args * @return {number} */var argumentsLength = function(...args) { return args.length}; /** * @param {Function} fn * @return {Function} */var once = function(fn) { let called = false; return function(...args){ if (!called) { called = true; return fn(...args); } return undefined; }}..
2025.05.11 07:04 -
[30 Days of JS] Array reduce transformation / Function composition
/** * @param {number[]} nums * @param {Function} fn * @param {number} init * @return {number} */var reduce = function(nums, fn, init) { let value = init; if (!nums.length) { return init; } else { for (let i = 0; i nums array가 비어있는 경우 따로 처리해주기 -> 코드를 넣지 않아도 알아서 처리가 되지만, 혹시 몰라서 추가/** * @param {Function[]} functions * @return {Function} */var compose = function(functions) { ..
2025.05.10 06:07