Javascript
![[Js] ๋ฐฐ์ด ์์ฑ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2Fcj2iXk%2FbtrHZjxBz0w%2FAAAAAAAAAAAAAAAAAAAAAAnQVTfAT5KiRYBzd-sydZpB5VHMp3Zt5hmyPTL9XGNT%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1759244399%26allow_ip%3D%26allow_referer%3D%26signature%3DESxytDYKRfyI36fyJiWZSYkrJv4%253D)
[Js] ๋ฐฐ์ด ์์ฑ
interface ArrayConstructor { /** * Creates an array from an array-like object. * @param arrayLike An array-like object to convert to an array. */ from(arrayLike: ArrayLike): T[]; /** * Creates an array from an iterable object. * @param arrayLike An array-like object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' u..
Bind
this.x = 9; var module = { x: 81, getX: function() { return this.x; } }; module.getX(); // 81 var retrieveX = module.getX; retrieveX(); // 9 ๋ฐํ - ํจ์๊ฐ ์ ์ญ ์ค์ฝํ์์ ํธ์ถ๋์ // module๊ณผ ๋ฐ์ธ๋ฉ๋ 'this'๊ฐ ์๋ ์๋ก์ด ํจ์ ์์ฑ // ์ ์ ํ๋ก๊ทธ๋๋จธ๋ ์ ์ญ ๋ณ์ x์ // module์ ์์ฑ x๋ฅผ ํผ๋ํ ์ ์์ var boundGetX = retrieveX.bind(module); boundGetX(); // 81 this.name ='์๋'; let person1 = { name: '์๋ฌด๋ฌด' }; let person2 = { name: '๋ญ์ค', study: functio..
![[์๋ฐ์คํฌ๋ฆฝํธ] ์ฑ๊ธ์ค๋ ๋, ๋น๋๊ธฐ์ฒ๋ฆฌ, ์ฝ๋ฐฑํจ์](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2F7UyYZ%2FbtrDthCtVYf%2FAAAAAAAAAAAAAAAAAAAAABzIzuymcL2CrBw_ZFd06_6RqX3vGQtvW2nGPyQ-uasO%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1759244399%26allow_ip%3D%26allow_referer%3D%26signature%3DK%252BWNtSZgn2hq%252B1%252BmS6q8CbSWklU%253D)
[์๋ฐ์คํฌ๋ฆฝํธ] ์ฑ๊ธ์ค๋ ๋, ๋น๋๊ธฐ์ฒ๋ฆฌ, ์ฝ๋ฐฑํจ์
https://www.freecodecamp.org/news/synchronous-vs-asynchronous-in-javascript/ Synchronous vs Asynchronous JavaScript – Call Stack, Promises, and More Let me start this article by asking, "What is JavaScript"? Well, here's the most confusing yet to-the-point answer I have found so far: > JavaScript is a single-threaded, non-blocking, asynchronous, concurrent programming language with lots of flexi..
[์๋ฐ์คํฌ๋ฆฝํธ] ๋งค๊ฐ๋ณ์, ์ธ์ ์ฉ์ด ์ฐจ์ด
https://velog.io/@colki/JS-parameter-%EC%99%80-argument-%EC%9D%98-%EC%B0%A8%EC%9D%B4-%EC%9D%B8%EC%88%98-%EC%9D%B8%EC%9E%90 [JS] parameter ์ argument ์ ์ฐจ์ด (์ธ์, ์ธ์) parameter์ argument ์ฐจ์ด์ ๊ฐ๊ฐ์ ๊ฐ๋ฅดํค๋ ์ฉ์ด์ ๋ํด์ ์ ๋ฆฌํด๋ณด์๋ค. velog.io ๊ณ์ ํท๊ฐ๋ ค์ ์ด์ ๋ถ๋ช ํ ์๊ธฐ!
[NodeJs] Get, Post
https://xzio.tistory.com/1753 [NodeJS] ํ๋ผ๋ฏธํฐ ์ ๋ฌ - GET, POST ๋ค์ด๊ฐ๋ฉฐ node.js์์ http๋ชจ๋์ ์ฌ์ฉํ์ฌ ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๋ฐฉ์์ธ GET๊ณผ POST ๋ฐฉ์์ ๋ํด์ ํฌ์คํ ์ ํ๋ ค๊ณ ํฉ๋๋ค. ์ฐ๋ฆฌ๊ฐ ํํ ์นํ์ด์ง๋ฅผ ์์ฒญํ๋ ์์ ์ GET๋ฐฉ์์ด๊ณ , id, pwd์ ์ ๋ ฅํ xzio.tistory.com
![[๋ฆฌ์กํธ] ์ปดํฌ๋ํธ ๋จ์ถํค ๊นกํจ rafce](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbuaXei%2FbtrCVeuAsne%2FAAAAAAAAAAAAAAAAAAAAAADkjrfUheuZFXOilXPWE66fIc9GQrL6X_0-ZcNP52qt%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1759244399%26allow_ip%3D%26allow_referer%3D%26signature%3Daw531topP8CeWOLFCgVqhU35hWY%253D)
[๋ฆฌ์กํธ] ์ปดํฌ๋ํธ ๋จ์ถํค ๊นกํจ rafce
๋ฆฌ์กํธ์ ์ต๊ณ ์ฅ์ , ์ปดํฌ๋ํธ๋ผ๋ ๊ฐ๋ ์ ๊ฐ๋ฐ์๊ฐ ์ํ๋๊ธ ๋ฌถ์ด์ ํ๊ทธํ(์ปดํฌ๋ํธ)ํ ์ํฌ ์ ์๋ค๋ ๊ฒ์ด๋ค. Box.js๋ก ์๋ช ํ js ํ์ผ์ rafce ์์ฑ ํ ์ํฐ์น๋ฉด! import React from 'react' const box = () => { return ( ) } export default box ์์ ๊ฐ์ ํ ํ๋ฆฟ์ด ๋ฐ๋ก ๋ง๋ค์ด์ง๋ค. ์ปดํฌ๋ํธ ๋ง๋ค ์ ์ฃผ์ ์ฌํญ: ์ปดํฌ๋ํธ ์ด๋ฆ์ ๋ฐ๋์ ๋๋ฌธ์๋ก ์์ํด์ผ ํ๋ค. ์ด๋ ๋ฆฌ์กํธ๊ฐ ์ปดํจ๋ํธ์ ์ผ๋ฐ html ํ๊ทธ๋ฅผ ๊ตฌ๋ณํ๋ ๋ฐฉ๋ฒ์ด ๋๋ฌน๋ฐ๋ก ์์ํ๋์ง ์ฌ๋ถ๋ฅผ ๊ฒํ ํ๊ธฐ ๋๋ฌธ์ด๋ค. 1. ๋ฐ๋ณต๋๋ ์์ดํ 2. ๊ธฐ๋ฅ๋ณ ์์ดํ (ํ ์คํธ, ์ ์ง๋ณด์ ์ฉ์ด) 3. ๋์ค์ ์ฌํ์ฉ๋ ๊ฒ์ผ๋ก ์์๋๋ ๊ธฐ๋ฅ \first-react\src\App.js import "./A..
[์๋ฐ์คํฌ๋ฆฝํธ] ์ต๋ช ํจ์, ํ์ดํ ํจ์, ์ฝ๋ฐฑํจ์
let onComplete = () => { console.log('๋๋ง๊ณจ'); }; class Welcome { to(onComplete) { onComplete(); } } const welcome = new Welcome(); welcome.to(onComplete); //๋๋ง๊ณจ ์ต๋ช ํจ์ ํ์ ) var(ํน์ let) ๋ณ์๋ช = function(๋งค๊ฐ๋ณ์๋ช : ์๋ฃํ) { ์ฒ๋ฆฌ๊ตฌ๋ฌธ } ๋ณ์๊ฐ ํจ์์ ์ด๋ฆ์ ๋์ ํ๊ฒ ๋๊ณ , ์ด ๋ณ์๋ฅผ ์ฌ์ฉํด์ ํจ์์ ๊ธฐ๋ฅ์ ์คํํ ์ ์๋ค. ์๋ฐ์คํฌ๋ฆฝํธ, ํจ์๋ฅผ ๋ง๋ค๋ ์ฌ์ฉํ๋ ์ผ๋ฐ์ ์ธ ๋ฐฉ๋ฒ var pow_ = function(x:number){ //function pow_(x:number) console.log('x=>'+x); return x*x; } console..
![[์๋ฐ์คํฌ๋ฆฝํธ] crazy this, ํท๊ฐ๋ฆฌ๋ ์๋ฐ์คํฌ๋ฆฝํธ this ์์ ์ด์ ๋ฆฌ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdna%2FbyEkfo%2FbtrCLADOKQ8%2FAAAAAAAAAAAAAAAAAAAAAE_OO4nha0uVH3gxds40AOec6chyua_LEj-pfcv8YVdf%2Fimg.png%3Fcredential%3DyqXZFxpELC7KVnFOS48ylbz2pIh7yKj8%26expires%3D1759244399%26allow_ip%3D%26allow_referer%3D%26signature%3D%252Fye9Wmk6ytQB6nns9uTCVcEMAa0%253D)
[์๋ฐ์คํฌ๋ฆฝํธ] crazy this, ํท๊ฐ๋ฆฌ๋ ์๋ฐ์คํฌ๋ฆฝํธ this ์์ ์ด์ ๋ฆฌ
https://poiemaweb.com/es6-arrow-function Arrow function | PoiemaWeb Arrow function(ํ์ดํ ํจ์)์ function ํค์๋ ๋์ ํ์ดํ(=>)๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ๋ตํ ๋ฐฉ๋ฒ์ผ๋ก ํจ์๋ฅผ ์ ์ธํ ์ ์๋ค. ํ์ง๋ง ๋ชจ๋ ๊ฒฝ์ฐ ์ฌ์ฉํ ์ ์๋ ๊ฒ์ ์๋๋ค. ๋ฌธ๋ฒ์ ์๋์ ๊ฐ๋ค. poiemaweb.com ใด> ๊ฐ์ฅ ์ ํํ๊ณ ์์ธํ๊ณ ํ๋ถํ ์์๋ก ์ค๋ช ๋์ด ์๋ ๋ฌธ์ const obj = { name: '๊ผฌ๋ถ๊ธฐ', sayName: () => { console.log(this.name); } } obj.sayName(); class Counter { name = 'counter'; count = 0; increase = () => { console.log(th..
[์๋ฐ์คํฌ๋ฆฝํธ] export default
https://ko.javascript.info/import-export#ref-4122 ๋ชจ๋ ๋ด๋ณด๋ด๊ณ ๊ฐ์ ธ์ค๊ธฐ ko.javascript.info ๋ชจ๋์ ํฌ๊ฒ ๋ ์ข ๋ฅ๋ก ๋๋ฉ๋๋ค. ๋ณต์์ ํจ์๊ฐ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํํ์ ๋ชจ๋(์ ์์์ say.js) ๊ฐ์ฒด ํ๋๋ง ์ ์ธ๋์ด์๋ ๋ชจ๋(์๋์ user.js. class User ํ๋๋ง ๋ด๋ณด๋ด๊ธฐ ํจ) ๋๊ฐ๋ ๋ ๋ฒ์งธ ๋ฐฉ์์ผ๋ก ๋ชจ๋์ ๋ง๋๋ ๊ฑธ ์ ํธํ๊ธฐ ๋๋ฌธ์ ํจ์, ํด๋์ค, ๋ณ์ ๋ฑ์ ๊ฐ์ฒด๋ ์ ์ฉ ๋ชจ๋ ์์ ๊ตฌํ๋ฉ๋๋ค. ๊ทธ๋ฐ๋ฐ ์ด๋ ๊ฒ ๋ชจ๋์ ๋ง๋ค๋ค ๋ณด๋ฉด ์์ฐ์ค๋ ํ์ผ ๊ฐ์๊ฐ ๋ง์์ง ์๋ฐ์ ์์ต๋๋ค. ๊ทธ๋ ๋๋ผ๋ ๋ชจ๋ ์ด๋ฆ์ ์ ์ง์ด์ฃผ๊ณ , ํด๋์ ํ์ผ์ ์ ๋๋ ํ๋ก์ ํธ๋ฅผ ๊ตฌ์ฑํ๋ฉด ์ฝ๋ ํ์์ด ์ด๋ ต์ง ์์ผ๋ฏ๋ก ์ด๋ ์ ํ ๋ฌธ์ ๊ฐ ๋์ง ์์ต๋๋ค. ๋ชจ๋์ export de..
[Node.js] ๋ชจ๋ (export, require)
- package.json ์ "type": "module", ์ถ๊ฐํด์ค ๊ฒ - export ํค์๋ ์ฌ์ฉ - import {๊ฐ์ ธ์ฌ์ด๋ฆ1, ๊ฐ์ ธ์ฌ์ด๋ฆ2 . . . } from '๊ฒฝ๋ก์ง์ ' - ํ๊บผ๋ฒ์ : import * as ๊ฐ์ ธ์ฌ์ด๋ฆ from "๊ฒฝ๋ก์ง์ "; ์จ์ค๋ค์์ ๊ฐ์ ธ์ฌ์ด๋ฆ.๊ฐ์ ธ์ฌํจ์๋ช () ์ด๋ฐ์์ผ๋ก ๋ถ๋ฆ counter.js let count = 0; function increase() { return count++; } function getCount() { return count; } module.exports.getCount = getCount; module.exports.increase = increase; ์ ์ฝ๋์ ๋์ผ ๊ธฐ๋ฅ let count = 0; function increase() { ..