전체 글 (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 이전 1 ··· 18 19 20 21 22 23 24 ··· 68 다음