분류 전체보기169 [리액트] setState 비동기 해결, 콜백함수 [예시 - 결과, 코드] 버튼을 클릭하면 숫자를 1 더하고 빼는 간단한 컴포넌트를 만들었다. alertNumber()라는 함수를 만들어 현재 숫자가 무엇인지 알려주는 창을 띄어준다. import React, { Component } from "react"; class Counter extends Component { state = { number: 0, }; alertNumber() { alert(this.state.number); } render() { const { number } = this.state; return ( {number} { this.setState({ number: number + 1 }); console.log(this.state); this.alertNumber(); }} > +.. 2021. 7. 12. [파이썬/알고리즘] 프로그래머스-숫자 문자열과 영단어 (카카오 2021 인턴십 코딩테스트) [문제] 네오와 프로도가 숫자놀이를 하고 있습니다. 네오가 프로도에게 숫자를 건넬 때 일부 자릿수를 영단어로 바꾼 카드를 건네주면 프로도는 원래 숫자를 찾는 게임입니다. 다음은 숫자의 일부 자릿수를 영단어로 바꾸는 예시입니다. 1478 → "one4seveneight" 234567 → "23four5six7" 10203 → "1zerotwozero3" 이렇게 숫자의 일부 자릿수가 영단어로 바뀌어졌거나, 혹은 바뀌지 않고 그대로인 문자열 s가 매개변수로 주어집니다. s가 의미하는 원래 숫자를 return 하도록 solution 함수를 완성해주세요. 참고로 각 숫자에 대응되는 영단어는 다음 표와 같습니다. 숫자 영단어 0 zero 1 one 2 two 3 three 4 four 5 five 6 six 7 s.. 2021. 7. 9. 리액트 VSCode 자동완성 익스텐션 추천 (Auto Import, Code snippets 등) 리액트를 공부하며 필요한 익스텐션을 정리해보았다. - Auto Import - ES6, TS, JSX, TSX Auto Import - ES6, TS, JSX, TSX - Visual Studio Marketplace Extension for Visual Studio Code - Automatically finds, parses and provides code actions and code completion for all available imports. Works with JavaScript and TypeScript. [Forked] marketplace.visualstudio.com 파일명을 입력하면 자동으로 import가 된다. [예시] 만약 SearchHeader라는 컴포넌트가 있고, 다른 파.. 2021. 7. 6. [파이썬/알고리즘] Leetcode - 937. Reorder Data in Log Files [문제] You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: Letter-logs: All words (except the identifier) consist of lowercase English letters. Digit-logs: All words (except the identifier) consist of digits. Reorder these logs so that: The letter-logs come before all digit-logs. The letter-logs are sor.. 2021. 7. 3. [파이썬/알고리즘] Leetcode - 1689. Partitioning Into Minimum Number Of Deci-Binary Numb [문제] A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For example, 101 and 1100 are deci-binary, while 112 and 3001 are not. Given a string n that represents a positive decimal integer, return the minimum number of positive deci-binary numbers needed so that they sum up to n. [예시] Example 1: Input: n = "32" Output: 3 Explanation: 10 + 11 + .. 2021. 6. 28. [파이썬/알고리즘] 프로그래머스 - JadenCase 문자열 만들기 (정규식) 문제 설명 JadenCase란 모든 단어의 첫 문자가 대문자이고, 그 외의 알파벳은 소문자인 문자열입니다. 문자열 s가 주어졌을 때, s를 JadenCase로 바꾼 문자열을 리턴하는 함수, solution을 완성해주세요. 제한 조건 s는 길이 1 이상인 문자열입니다. s는 알파벳과 공백문자(" ")로 이루어져 있습니다. 첫 문자가 영문이 아닐때에는 이어지는 영문은 소문자로 씁니다. ( 첫 번째 입출력 예 참고 ) 입출력 예 s return "3people unFollowed me" "3people Unfollowed Me" "for the last week" "For The Last Week" "aaaaa aaa" "Aaaaa Aaa" "hello m y friend" "Hello M Y Friend" .. 2021. 6. 26. 이전 1 ··· 8 9 10 11 12 13 14 ··· 29 다음