JavaScript

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๊ฐ€์žฅ ์ค‘์š”ํ•œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด ์ƒ์„ฑ๊ณผ ์กฐ์ž‘, JSON, ๋ฉ”์„œ๋“œ ๊ฐœ๋…๊ณผ ์‚ฌ์šฉ๋ฒ•

martinooo 2024. 7. 2. 11:34

 

 

 

 

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ ์ค‘์š”ํ•œ ๋ฐฐ์—ด ์‚ฌ์ „ ์ง€์‹ ๊ณต๋ถ€ํ•˜๊ธฐ


 

 

๋ฐฐ์—ด reduce() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

https://cometruedream.tistory.com/259

 

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array) filter ํ•จ์ˆ˜์˜ ๊ฐœ๋…๋ฐ ์‚ฌ์šฉ๋ฒ•

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ ์ค‘์š”ํ•œ ๋ฐฐ์—ด ์‚ฌ์ „ ์ง€์‹ ๊ณต๋ถ€ํ•˜๊ธฐ "> HTML ์‚ฝ์ž…๋ฏธ๋ฆฌ๋ณด๊ธฐํ•  ์ˆ˜ ์—†๋Š” ์†Œ์Šค๋ฐฐ์—ด reduce() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐhttps://cometruedream.tistory.com/256 [์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array) redu

cometruedream.tistory.com

 


๋ฐฐ์—ด reduce() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

https://cometruedream.tistory.com/256

 

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array) reduce ํ•จ์ˆ˜์˜ ๊ฐœ๋…๋ฐ ํ™œ์šฉ๋„ ๋†’์€ ์‚ฌ์šฉ๋ฒ•

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ ์ค‘์š”ํ•œ ๋ฐฐ์—ด ์‚ฌ์ „ ์ง€์‹ ๊ณต๋ถ€ํ•˜๊ธฐ ๋ฐฐ์—ด join() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐhttps://cometruedream.tistory.com/254 [์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array)์„ ์œ ์šฉํ•˜๊ฒŒ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” join ํ•จ์ˆ˜ ๊ฐœ

cometruedream.tistory.com

 

 

๋ฐฐ์—ด join() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

https://cometruedream.tistory.com/254

 

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array)์„ ์œ ์šฉํ•˜๊ฒŒ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” join ํ•จ์ˆ˜ ๊ฐœ๋… ๋ฐ ์‚ฌ์šฉ๋ฒ•

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ๋ฐฐ์—ด์€ javascript์—์„œ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ๋ฐ์ดํ„ฐ ์ž๋ฃŒ๊ตฌ์กฐ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค.๋ฐฐ์—ด์— ๋‚ด์žฅํ•จ์ˆ˜๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ์€ javascript์—์„œ ์ค‘์š”ํ•œ ๋ถ€๋ถ„ ์ค‘ ํ•˜๋‚˜์ด๋ฉฐ join() ๋ฐฐ์—ด ๋ฉ”์„œ๋“œ๋Š” ๋ฐฐ์—ด์„ ํ•ฉ

cometruedream.tistory.com

 

 

๋ฐฐ์—ด map(), forEach() ์ธ๊ธฐ ์žˆ๋Š” ๋ฉ”์„œ๋“œ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

https://cometruedream.tistory.com/253

 

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด(array)์„ ์ฒ˜๋ฆฌํ•˜๋Š” ์ธ๊ธฐ์žˆ๋Š” ๋ฉ”์†Œ๋“œ map(), forEach() ๊ฐœ๋…๊ณผ ์ฐจ์ด์ 

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ํ˜„์žฌ ์›น/์•ฑ ๊ฐœ๋ฐœ ํŠธ๋ Œ๋“œ์—์„œ ํ•„์ˆ˜์ ์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ ์•„์ดํ…œ์„ ์ €์žฅํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ๋ฐฐ์—ด๊ณผ ์ด๋ฅผ ํŒŒ์‹ฑํ•˜๋ฉฐ ์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ๋ฅผ

cometruedream.tistory.com

 

 

ํ™œ์šฉ๊ฐ€์น˜๊ฐ€ ์ข‹์€ every(), some() ํ•จ์ˆ˜ ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ธฐ

https://cometruedream.tistory.com/250

 

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ํ™œ์šฉ๊ฐ€์น˜๊ฐ€ ์ข‹์€ ๋‚ด์žฅํ•จ์ˆ˜์™€ every(), some() ํ•จ์ˆ˜์˜ ๊ฐœ๋… ๋ฐ ํ™œ์šฉ๋ฒ•

๐Ÿคท‍โ™‚๏ธ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๋‚ด์žฅ ํ•จ์ˆ˜๋ž€?์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ํšจ์œจ์ ์œผ๋กœ ํ™œ์šฉํ•˜๋ ค๋ฉด ๋‚ด์žฅ ํ•จ์ˆ˜๋ฅผ ์ž˜ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.๋‚ด์žฅ ํ•จ์ˆ˜๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ๋ฏธ๋ฆฌ ์„ ์–ธ๋œ ํ•จ์ˆ˜๋กœ, ํ˜ธ์ถœ๋งŒ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต

cometruedream.tistory.com

 

 

๐Ÿคท‍โ™‚๏ธ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋ž€?


์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์ž…๋‹ˆ๋‹ค.

๊ฐ์ฒด ์ง€ํ–ฅ ๋ง ๊ทธ๋Œ€๋กœ ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅ, ์กฐํšŒ, ์ˆ˜์ •, ์‚ญ์ œ์˜ ์ฝ”๋“œ๋ฅผ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค.

๊ฐ์ฒด๋˜๋Š” object๋ผ๊ณ ๋„ ๋ถ€๋ฆ…๋‹ˆ๋‹ค. ๊ฐ์ฒด๋Š” ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ ์œ ํ˜•๊ณผ ๋‹ฌ๋ฆฌ ๋™์ ์œผ๋กœ ์†์„ฑ์„ ์ถ”๊ฐ€, ์‚ญ์ œ, ์ˆ˜์ •์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ „๋ฌธ์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๊ฐ์ฒด์˜ ๊ฐœ๋…๊ณผ ์‚ฌ์šฉ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋Š” ๋ฌด์—‡์ธ๊ฐ€?

๐Ÿ’ก ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•˜๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ชจ๋‘ ํฌํ•จํ•˜๋Š” ๋ฐ์ดํ„ฐ ์œ ํ˜•์ž…๋‹ˆ๋‹ค. ๊ฐ์ฒด๋Š” {}๋กœ ํ‘œ์‹œ๋˜๋ฉฐ ๊ฐ์ฒด๋Š” ์†์„ฑ์ด๋ผ๊ณ  ํ•˜๋Š” ๋ณ€์ˆ˜์™€ ํ•จ์ˆ˜๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ์†์„ฑ์€ ๊ฐ์ฒด์˜ ์ƒํƒœ๋ฅผ ์ €์žฅํ•˜๊ณ  ํ•จ์ˆ˜๋Š” ๊ฐ์ฒด์˜ ๋™์ž‘์„ ๊ฒฐ์ •ํ•ฉ๋‹ˆ๋‹ค.

 

 

๐Ÿคท‍โ™‚๏ธ ๊ฐ์ฒด(object)๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•?


์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•๋“ค์ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ์€ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ• ์ค‘ ๋ช‡ ๊ฐ€์ง€ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

 

๋ฆฌํ„ฐ๋Ÿด ํ‘œ๊ธฐ๋ฒ•(Literal Notation)

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 28,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

 

๊ฐ์ฒด ๋ฆฌํ„ฐ๋Ÿด ๋ฐฉ์‹์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ์œ ์—ฐํ•จ๊ณผ ๊ฐ•๋ ฅํ•จ์„ ๋Œ€ํ‘œํ•˜๋Š” ๊ฐ์ฒด ์ƒ์„ฑ ๋ฐฉ์‹์ด๋‹ค.

๊ฐ์ฑ„๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด์„œ ํด๋ž˜์Šค๋ฅผ ์ •์˜ํ•˜๊ฑฐ๋‚˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ์–ธํ•˜์ง€ ์•Š๊ณ ๋„ ์‰ฝ๊ฒŒ ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ƒ์„ฑ์ž ํ•จ์ˆ˜(Constructor Function)

function Person(firstName, lastName, age) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
    this.fullName = function() {
        return this.firstName + " " + this.lastName;
    }
}

const person = new Person("๊ตญํ˜„", "์œ ", 28);

 

 

๐Ÿคท‍โ™‚๏ธ ๊ฐ์ฒด(object)๋ฅผ ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•?


์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ๊ฐ์ฒด์˜ ์†์„ฑ์— ์ ‘๊ทผํ•˜๋Š” ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

๊ฐ์ฒด์˜ ์†์„ฑ์—๋Š” ์ (dot)๊ณผ ๋Œ€๊ด„ํ˜ธ(bracket)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ (dot) ๊ฐ์ฒด ์ ‘๊ทผ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

console.log(person.firstName); // ๊ฒฐ๊ณผ๊ฐ’: ๊ตญํ˜„

 

 

๋Œ€๊ด„ํ˜ธ(bracket) ๊ฐ์ฒด ์ ‘๊ทผ๋ฒ•

const person = {
 firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

console.log(person["firstName"]); // ๊ฒฐ๊ณผ๊ฐ’: ๊ตญํ˜„

 

๋Œ€ํ‘œ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ์ (dot)๊ณผ ๋Œ€๊ด„ํ˜ธ(bracket) ํ™œ์šฉํ•ด์„œ ๊ฐ์ฒด์˜ ์†์„ฑ์— ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค.

 

๐Ÿคท‍โ™‚๏ธ ๊ฐ์ฒด(object) ๋‹ค๋ฃจ๊ธฐ?


์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ ๊ฐ์ฒด๋ฅผ ๋‹ค๋ฃจ๋Š” ์—ฌ๋Ÿฌ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

๊ฐ์ฒด์˜ ๊ฐ’์„ ๋ณ€๊ฒฝํ•˜๊ณ  ์ƒˆ๋กœ์šด ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

๊ณต๋ถ€ํ•˜๋ฉด ์ข‹์€ immer๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ถˆ๋ณ€์„ฑ์„ ์ง€์ผœ์•ผํ•˜๋Š” ์ด์œ ์™€ ์–•์€ ๋ณต์‚ฌ์˜ ๊ฐœ๋…

https://cometruedream.tistory.com/223

 

immer๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋ถˆ๋ณ€์„ฑ์„ ์ง€์ผœ์•ผํ•˜๋Š” ์ด์œ ์™€ ์–•์€ ๋ณต์‚ฌ์˜ ๊ฐœ๋…

immer ๋ž€? React์—์„œ ๋ถˆ๋ณ€์„ฑ์„ ์œ ์ง€ํ•˜๋Š๋ผ ๋‚œ์žกํ•ด์ง„ ์ฝ”๋“œ๋ฅผ ์งง๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ๋ถˆ๋ณ€์„ฑ์„ ์œ ์ง€ํ• ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ด๋‹ค. ๋ฐ˜๋Œ€๋กœ immer ์‚ฌ์šฉํ•จ์œผ๋กœ ์งง์€ ์ฝ”๋“œ๊ฐ€ ๊ธธ์–ด์ง€๋Š” ๊ฒฝ์šฐ๋„ ์žˆ๋‹ค. ๋ถˆ๋ณ€์„ฑ

cometruedream.tistory.com

 

 

๊ฐ์ฒด ์ˆ˜์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

person.firstName = "์žฅํ˜„";
person.age = 29;

console.log(person.firstName) //๊ฒฐ๊ณผ๊ฐ’: ์žฅํ˜„

 

 

 

๊ฐ์ฒด ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

pserson.area = '์„œ์šธ'

console.log(pserson.area) //๊ฒฐ๊ณผ๊ฐ’: ์„œ์šธ

 

 

๊ฐ์ฒด ์‚ญ์ œํ•˜๋Š” ๋ฐฉ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

delete person.age

console.log(pserson.age) //undefined

 

 

๊ฐ์ฒด ๋ณ‘ํ•ฉํ•˜๋Š” ๋ฐฉ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

const coiedPerson = Object.assign({}, person)

console.log(coiedPerson) 

//๊ฒฐ๊ณผ๊ฐ’:  
{
    "firstName": "๊ตญํ˜„",
    "lastName": "์œ ",
    "age": 32
}

 

 

๊ฐ์ฒด๋ฅผ ๋ถ„ํ•ดํ•˜๋Š” ๋ฐฉ๋ฒ•

๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹น์ด๋ฉฐ ๋งŽ์ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

const {firstName, lastName, age} = person;

console.log(firstName) //๊ตญํ˜„
console.log(lastName) //์œ 
console.log(age) //32

 

 

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์ด๋ฉฐ ๊ฐ์ฒด๋Š” key์™€ value ์†์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉด ์œ„์—์„œ ์ถ”๊ฐ€, ์‚ญ์ œ, ์ˆ˜์ •, ๋ณ‘ํ•ฉ, ๊ตฌ์กฐ๋ถ„ํ•ดํ• ๋‹น์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค.

 

 

๐Ÿคท‍โ™‚๏ธ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด์™€ JSON?


JSON์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋ฅผ ์ „์†กํ•˜๊ธฐ ์œ„ํ•œ ๊ฒฝ๋Ÿ‰ ๋ฐ์ดํ„ฐ ๊ตํ™˜ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ๋Š” ๊ฐ์ฒด๋ฅผ JSON์œผ๋กœ JSON์„ ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋‹ค๋ฅธ ์‹œ์Šคํ…œ์— ์ „์†กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

JSON ๋ฌธ์ž์—ด ํŠน์ง•

๐Ÿ’ก JSON ๋ฌธ์ž์—ด์— ํŠน์ง•์€ key์™€ value ์Œ๋‹ค์šดํ‘œ์— ๊ฐ์‹ธ์ ธ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

๊ฐ์ฒด๋ฅผ ๋ถ„ํ•ดํ•˜๋Š” ๋ฐฉ๋ฒ•

const person = {
    firstName: "๊ตญํ˜„",
    lastName: "์œ ",
    age: 32,
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}

console.log(JSON.stringify(person))
//๊ฒฐ๊ณผ๊ฐ’: {"firstName":"๊ตญํ˜„","lastName":"์œ ","age":32}

 

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋ฅผ JSON ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ•

const json = '{"firstName":"๊ตญํ˜„","lastName":"์œ ","age":32}'
const person = JSON.parse(json);
console.log(person);

 

๐Ÿคท‍โ™‚๏ธ ๋งˆ์ง€๋ง‰์œผ๋กœ


์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ฐ์ฒด๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์กฐ์ž‘ํ•˜๋Š” ๋ฉ”์†Œ๋“œ๋ฅผ ๋ชจ๋‘ ํฌํ•จํ•œ key์™€ value์˜ ๋ฐ์ดํ„ฐ ์œ ํ˜•์ž…๋‹ˆ๋‹ค.

๊ฐ์ฒด๋ฅผ ์ƒ์„ฑ, ์ˆ˜์ •, ์‚ญ์ œ, ๋ณ‘ํ•ฉ, ์กฐํšŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด์•˜์œผ๋ฉฐ ๊ฐ์ฒด์™€ JSON ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค.

๊ฐ์ฒด๋ฅผ ๋‹ค๋ฃจ๋Š” ๊ฒƒ์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํ”„๋กœ๊ทธ๋žจ์—์„œ ์ค‘์š”ํ•œ ๊ธฐ์ˆ ์ด๋ฉฐ ์ง€๊ธˆ์€ ๊ธฐ๋ณธ์ ์ธ ๋ถ€๋ถ„๋งŒ ๋‹ค๋ค˜์ง€๋งŒ ๋” ์ „๋ฌธ์„ฑ์„ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๊ณ„์†ํ•ด์„œ ๊ณต๋ถ€๋ฅผ ํ•ด์•ผ๊ฒ ์Šต๋‹ˆ๋‹ค.


 

์žฌ๋ฐŒ๋Š” ์˜ค๋Š˜์˜ ๋ ๋ณ„ ์šด์„ธ ๋ณด๊ณ  ๊ฐ€์„ธ์š”! 

 

 

https://cometruedream.tistory.com/247

 

[React] Tailwind ํ•œ์ค„, ๋‘์ค„, ์„ธ์ค„ ํšจ๊ณผ className ์ปค์Šคํ…€

๐Ÿคท‍โ™‚๏ธ Tailwind ํ•œ์ค„, ๋‘์ค„, ์„ธ์ค„ ํšจ๊ณผํ”„๋กœ์ ํŠธ ์ง„ํ–‰์ค‘ ๋ฐฐ๋„ˆ ๋งํฌ์— URL ๊ธธ์ด๊ฐ€ ๋„ˆ๋ฌด ๊ธธ์–ด์„œ 3์ค„ ํšจ๊ณผ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. React + Tailwind CSS ์…‹ํŒ…๋œ ํ”„๋กœ์ ํŠธ ์—ฌ์„œ CSS ํŒŒ์ผ & style ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜

cometruedream.tistory.com

 

 

https://cometruedream.tistory.com/243

 

NestJS Lifecycle (์ƒ๋ช…์ฃผ๊ธฐ) ๊ฐœ๋…

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œ Nest JS ๊ฐœ๋…?Nest JS๋Š” Node JS ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ์„œ๋ฒ„ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋ ˆ์ž„์›Œํฌ ์ž…๋‹ˆ๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ์ƒ๋‹นํžˆ ์˜ค๋žซ๋™์•ˆ Express ๊ธฐ๋ฐ˜์œผ๋กœ ์„œ๋ฒ„ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์—์„œ ์••๋„์ ์ธ ์ 

cometruedream.tistory.com

 

 

https://cometruedream.tistory.com/242

 

๋ฆฌ์•กํŠธ Vite Proxy ํ™œ์šฉํ•œ CORS ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œํ”„๋ก ํŠธ์—”๋“œ ๋ฒˆ๋“ค๋Ÿฌ ๊ฐœ๋…๊ณผ webpack vs vite ๋น„๊ต์— ๋Œ€ํ•ด์„œ ๊ณต๋ถ€๋ฅผ ํ•˜๊ณ  ๊ธ€์„ ๋ณด์‹œ๋ฉด ๋” ๋งŽ์€ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค^^ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋ฒˆ๋“ค๋Ÿฌ ๊ฐœ๋…๊ณผ webpack vs vite ๋น„๊ตhttps://comet

cometruedream.tistory.com

 

 

https://cometruedream.tistory.com/241

 

React ํด๋”๊ตฌ์กฐ FSD ๊ธฐ๋Šฅ ๋ถ„ํ™œ ์„ค๊ณ„ ์•„ํ‚คํ…์ฒ˜

๐Ÿคท‍โ™‚๏ธ ๋ณธ๋ก ์— ์•ž์„œํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ•˜๊ธฐ์— ์•ž์„œ ํด๋” ๊ตฌ์กฐ, ์„ค๊ณ„์— ๋Œ€ํ•œ ์•„ํ‚คํ…์ฒ˜๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์€ ์ƒ๋‹นํžˆ ์–ด๋ ต๋‹ค. ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์— React FSD ํด๋”๊ตฌ์กฐ ์•„ํ‚คํ…์ฒ˜๋ฅผ ์„ค๊ณ„ํ•  ์˜ˆ์ •์ด๋ผ์„œ FSD ์•„ํ‚คํ…

cometruedream.tistory.com

 

 

https://cometruedream.tistory.com/244

 

์‰ฝ๊ฒŒ ์ดํ•ดํ•˜๊ณ  ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๋Š” Prisma ๋ช…๋ น์–ด ์ •๋ฆฌ

๐Ÿคท‍โ™‚๏ธ Prisma ๋ช…๋ น์–ด ๋ณธ๋ก ์— ์•ž์„œ Prisma๋ž€?Nest JS ํ”„๋ ˆ์ž„์›Œํฌ์™€ Prisma ORM์„ ํ™œ์šฉํ•ด์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด์„œ Prisma๋Š” Node JS ๊ธฐ๋ฐ˜์— ํ”„๋ ˆ์ž„์›Œํฌ/๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์™€ ์ƒํ˜ธ์ž‘์šฉ์ด ์ž˜๋˜๋ฉฐ Prisma + DB ์—ฐ๋™์œผ

cometruedream.tistory.com