반응형

JavaScript

    [Node.js] Node.js + express를 사용한 서버 구성 시작하기

    Node.js 프로젝트 생성 express를 설치하고 사용하기 앞서 우선 Node.js를 설치하고 Node.js 프로젝트를 생성해야한다. Node.js 사이트에서 운영체제에 맞는 원하는 버전의 Node.js를 다운로드 받을 수 있다. Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. nodejs.org 다음으로 프로젝트 대상 폴더에서 터미널에 아래 명령어를 입력하여 package.json 파일을 생성한다. npm init 명령어를 입력하면 다음과 같은 기본적인 설정 정보들을 입력한다 혹은 -y 옵션을 통해 모든 항목을 기본값으로 설치한다. npm init -y 정상적으로 package.json 파일이 생성되었다..

    [LeetCode] 215. Kth Largest Element in an Array - Java

    https://leetcode.com/problems/kth-largest-element-in-an-array/description/ Kth Largest Element in an Array - LeetCode Can you solve this real interview question? Kth Largest Element in an Array - Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct eleme leetcode.com 문제 Given a..

    [JavaScript] 콜백 지옥(Callback Hell) 탈출을 위한 코드작성 - promise, async/await

    ❓ 콜백 함수 (callback function) 콜백(callback) 또는 콜백 함수(callback function)는 다른 코드의 인수로서 넘겨주는 실행 가능한 코드를 말한다. 콜백을 넘겨받는 코드는 이 콜백을 필요에 따라 즉시 실행할 수도 있고, 아니면 나중에 실행할 수도 있다. function sum(a, b, callback) { callback(a + b); } sum(2, 5, (result) => { console.log(result); }); 위 코드는 sum이라는 함수의 인자로 정수 a,b 와 콜백 함수를 넘겨 주며 콜백 함수에서는 두 정수 a와 b를 합한 결과인 result를 콘솔로 출력한다. ❓ 콜백 지옥 (callback hell) 콜백 지옥이란 JavaScript에서 비동기 ..

    [LeetCode] 518. Coin Change II - Java, JavaScript

    https://leetcode.com/problems/coin-change-ii/description/ Coin Change II - LeetCode Can you solve this real interview question? Coin Change II - You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the number of combinations that make up that leetcode.com 문제 You are given an integer array coins repre..

반응형