본문 바로가기

분류 전체보기

(204)
freeCodeCamp - 9. Finders Keepers [Basic Algorithm Scripting] Finders Keepers https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers www.freecodecamp.org function findElement(arr, func) { for (let a of arr){ if(func(a)) return a } } findElement([1, 2, 3, 4], num => num % 2 === 0);
freeCodeCamp - 8. Truncate a String [Basic Algorithm Scripting] Truncate a String https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/truncate-a-string www.freecodecamp.org function truncateString(str, num) { if(str.length > num) { return str.slice(0, num) + '...' } return str; } truncateString("A-tisket a-tasket A green and yellow basket", 8);
freeCodeCamp - 7. Repeat a String Repeat a String [Basic Algorithm Scripting] Repeat a String Repeat a String https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string www.freecodecamp.org function repeatStringNumTimes(str, num) { let answer = "" if(num
freeCodeCamp - 6. Confirm the Ending [Basic Algorithm Scripting] Confirm the Ending https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending www.freecodecamp.org function confirmEnding(str, target) { if(str.slice(-target.length, str.length) == target) return true return false; } confirmEnding("Bastian", "n");
freeCodeCamp - 5. Return Largest Numbers in Arrays [Basic Algorithm Scripting] Return Largest Numbers in Arrays https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays www.freecodecamp.org function largestOfFour(arr) { let myArr = [] for (let a of arr){ console.log(a) myArr.push(Math.max.apply(null, a)) } return myArr; } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 10..
freeCodeCamp - 4. Find the Longest Word in a String [Basic Algorithm Scripting] Find the Longest Word in a String https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string www.freecodecamp.org so1) function findLongestWordLength(str) { let arr = str.split(' ') let arr2 = [] for(let a of arr){ arr2.push(a.length) } return Math.max(...arr2) } findLongestWordLength("The quick brown fox jumped over t..
freeCodeCamp - 3. Factorialize a Number [Basic Algorithm Scripting] Factorialize a Number https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number www.freecodecamp.org function factorialize(num) { let sum = 1 if(num > 0) { for(let i=1; i
freeCodeCamp - 2. Reverse a String [Basic Algorithm Scripting] Reverse a String https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string www.freecodecamp.org function reverseString(str) { str = str.split('').reverse().join('') return str; } reverseString("hello");
freeCodeCamp - 1. Convert Celsius to Fahrenheit [Basic Algorithm Scripting] Convert Celsius to Fahrenheit function convertCtoF(celsius) { let fahrenheit; fahrenheit = celsius * 9/5 + 32 return fahrenheit; } convertCtoF(30); https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures www.freecodecamp.org
구글 로그인 라이브러리 변경 - 4. 라이브러리를 사용하지 않고 google OAuth 로 direct 요청 방식 구현 정리할 내용 Google Identity 간단 개념 (+ oauth) 👉 링크 구글 라이브러리에서 변경되는 내용 👉 링크 authorization 에서 flow 선택 (gsi/client 라이브러리 사용) 라이브러리를 사용하지 않고 google oauth api로 direct 요청하기 토이플젝을 통해서 code → token 얻어내는 과정 및 유의사항 기존 로그인 플로우 & 변경되는 로그인 플로우 설명 Direct Using Google OAuth 2.0 다시 한 번 목적을 생각해보자 나는 access_token 과 refresh_token을 사용하여 “로그인”을 이용할 것이다 refresh_token을 따로 관리해서 자동로그인 시켜주고 로그인이 거의 영원히 풀리지 않도록 하기 위해서 그리고 지금 라이브..