๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
728x90
๋ฐ˜์‘ํ˜•

Javascript54

GSAP โญ๏ธ GSAP โญ๏ธ GSAP๋ž€? GSAP (GreenSock Animation Platform)์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ž์ฃผ ์‚ฌ์šฉ๋˜์ง€๋งŒ ์ผ์ผํžˆ ๊ตฌํ˜„ํ•˜๊ธฐ ๋ถˆํŽธํ•˜๊ณ  ๊นŒ๋‹ค๋กœ์šด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ์˜ ํŠน์ • ๊ธฐ๋Šฅ์„ ๊ธฐ์„ฑํ’ˆ์œผ๋กœ ๋งŒ๋“ค์–ด ๋†“์€ ํŒจํ‚ค์ง€๋ผ๊ณ  ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. GSAP๋Š” ์„ธ๋ฐ€ํ•œ ์›€์ง์ž„๊ณผ ๋™์ž‘์˜ ์—ฐ์†์„ฑ์„ ๊ฐ„ํŽธํ•˜๊ฒŒ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋•์Šต๋‹ˆ๋‹ค. GSAP ์‚ฌ์šฉ ๋ฐฉ๋ฒ• 01. CDN ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ CDN (Contents Delivery Network)๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์‚ฐ๋œ ์„œ๋ฒ„์—์„œ ๋ฐ›์•„์˜ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. // CDN ์—์„œ ์ฃผ์†Œ๋ฅผ ๋ถˆ๋Ÿฌ์˜ด 02. ๊ณต์‹ ๋ฌธ์„œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ๊ณต์‹ ๋ฌธ์„œ(Docs) ๋˜๋Š” ๋ช…์„ธ์„œ(Specification)์„ ๊ณต์‹ ์›น์‚ฌ์ดํŠธ์— ๊ณต์œ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๊ธฐ์ดˆ ์ง€์‹, ์‚ฌ์šฉ๋ฒ•,.. 2022. 8. 29.
์Šฌ๋ผ์ด๋“œ ์ดํŽ™ํŠธ (2) โญ๏ธ ์Šฌ๋ผ์ด๋“œ ์ดํŽ™ํŠธ 02 โญ๏ธ 01. ์— ์ž‘์„ฑํ•˜๊ธฐ const sliderImg = document.querySelector(".slider__img"); // ๋ณด์—ฌ์ง€๋Š” ์˜์—ญ const sliderInner = document.querySelector(".slider__inner"); // ์›€์ง์ด๋Š” ์˜์—ญ const slider = document.querySelectorAll(".slider"); // ์ด๋ฏธ์ง€ let currentIndex = 0; // ํ˜„์žฌ ๋ณด์ด๋Š” ์ด๋ฏธ์ง€ let sliderCount = slider.length; // ์ด๋ฏธ์ง€ ๊ฐฏ์ˆ˜ sliderInner.style.transition = "all 0.6s" // ๋ถ€๋“œ๋Ÿฝ๊ฒŒ ๋„˜์–ด๊ฐ€๋„๋ก ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ฃผ๊ธฐ // sliderInn.. 2022. 8. 29.
์Šฌ๋ผ์ด๋“œ ์ดํŽ™ํŠธ (1) โญ๏ธ ์Šฌ๋ผ์ด๋“œ ์ดํŽ™ํŠธ 01 โญ๏ธ 01. ์— ์ž‘์„ฑํ•˜๊ธฐ // ๊ฐ€์šด๋ฐ ์ด๋ฏธ์ง€ ์Šฌ๋ผ์ด๋“œ const sliderWrap = document.querySelector(".slider__wrap"); const sliderImg = sliderWrap.querySelector(".slider__img"); // sliderWrap ์•ˆ์—์„œ ์ฐพ์œผ๋ผ๊ณ  document ๋Œ€์‹ ์— sliderWrap ์„ ์ ์–ด์คŒ const slider = sliderWrap.querySelectorAll(".slider"); let currentIndex = 0; // ํ˜„์žฌ ๋ณด์ด๋Š” ์ด๋ฏธ์ง€ let sliderCount = slider.length; // ์ด๋ฏธ์ง€ ๊ฐฏ์ˆ˜ setInterval(() => { // console.log(.. 2022. 8. 29.
ํ€ด์ฆˆ ๋งŒ๋“ค๊ธฐ (6) ๊ฐ๊ด€์‹ ์Šฌ๋ผ์ด๋“œ ์œ ํ˜• โญ๏ธ ๊ฐ๊ด€์‹ ๋‹ค์ˆ˜ ๋ฌธํ•ญ (์ •๋‹ต ๊ฐฏ์ˆ˜ / ํ•ฉ๊ฒฉ ์—ฌ๋ถ€ ํ™•์ธ) โญ๏ธ 01. ๋งŒ๋“œ๋Š” ์ˆœ์„œ 1) ์ถœ๋ ฅํ•  ๋‚ด์šฉ์ด ๋“ค์–ด์žˆ๋Š” ์š”์†Œ ์„ ํƒํ•˜๊ธฐ 2) ์งˆ๋ฌธ๊ณผ ์ •๋‹ต ๋‚ด์šฉ, ํ•„์š”ํ•œ ๊ฐ’ ์ž…๋ ฅํ•˜๊ธฐ 3) ์งˆ๋ฌธ ๋‚ด์šฉ ์ถœ๋ ฅํ•˜๊ธฐ 4) ์ •๋‹ต ๋‚ด์šฉ ์ˆจ๊ฒจ๋†“๊ธฐ 5) ์ •๋‹ต ํ™•์ธ ๋ฐ ๊ฒฐ๊ณผ๊ฐ’ ์„ค์ •ํ•˜๊ธฐ 6) ์ •๋‹ต ๋ฒ„ํŠผ์˜ ๋™์ž‘ ์„ค์ •ํ•˜๊ธฐ 02. ์— ์ž‘์„ฑํ•˜๊ธฐ // ๋ฌธ์ œ ์ •๋ณด const quizInfo = [ { answerType: "์›น ๋””์ž์ธ ๊ธฐ๋Šฅ์‚ฌ (2014๋…„ 01ํšŒ)", answerNum: "1", answerAsk: "๋‹ค์Œ์˜ ๋””์ž์ธ ์›๋ฆฌ ์ค‘ ๋ฆฌ๋“ฌ์— ํ•ด๋‹น๋˜์ง€ ์•Š๋Š” ๊ฒƒ์€?", answerChoice: [ "์ ์ด", "๊ฐ•์กฐ", "๊ท ์ผ", "์ ์ฆ", ], answerResult: "๊ท ์ผ", answerEx: "๊ท ์ผ // '๋ฆฌ๋“ฌ(์œจ๋™)'์€.. 2022. 8. 25.
search Effect (3) โญ๏ธ ํ‚ค์›Œ๋“œ ๋งŒ๋“ค๊ธฐ โญ๏ธ 01. ์— ์ž‘์„ฑํ•˜๊ธฐ // ์„ ํƒ์ž const searchKeyword = document.querySelectorAll(".search__info .keyword span"); // ์•ŒํŒŒ๋ฒณ ํ‚ค์›Œ๋“œ const searchList = document.querySelectorAll(".search__list ul li") // ๋ชฉ๋ก ๋ฆฌ์ŠคํŠธ const searchInfo = document.querySelector(".search__info .num") // ์ „์ฒด ๊ฐฏ์ˆ˜ const searchInfo2 = document.querySelector(".search__info .num2"); // ์ฐพ์€ ๊ฐฏ์ˆ˜ // ์ฐพ์€ ๊ฐฏ์ˆ˜ ์„ค์ •ํ•˜๊ธฐ searchInfo.textContent .. 2022. 8. 23.
search / march / charAt ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( search / march / charAt ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด.. 2022. 8. 23.
ํ•จ์ˆ˜์˜ ์œ ํ˜• โญ๏ธ ํ•จ์ˆ˜์˜ ์œ ํ˜• โญ๏ธ 01. ํ•จ์ˆ˜์™€ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์ด์šฉํ•œ ํ˜•ํƒœ function func(num, str1, str2){ document.write("(" + num + ") " + str1 + "๊ฐ€ " + str2 + "๋˜์—ˆ์Šต๋‹ˆ๋‹ค.") } func("13-1", "ํ•จ์ˆ˜", "์‹คํ–‰"); func("13-2", "์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ", "์ถ”๊ฐ€"); func("13-3", "์ œ์ด์ฟผ๋ฆฌ", "์‚ญ์ œ"); ๊ฒฐ๊ณผ ๋ณด๊ธฐ (13-1) ํ•จ์ˆ˜๊ฐ€ ์‹คํ–‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค.(13-2) ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.(13-3) ์ œ์ด์ฟผ๋ฆฌ๊ฐ€ ์‚ญ์ œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. 02. ํ•จ์ˆ˜์™€ ๋ณ€์ˆ˜๋ฅผ ์ด์šฉํ•œ ํ˜•ํƒœ const mynum1 = 14*1; const mynum2 = 14*2; const mynum3 = 14*3; const mystr1 = "ํ•จ์ˆ˜"; const my.. 2022. 8. 23.
search Effect (2) โญ๏ธ ๊ฒ€์ƒ‰์ฐฝ ๋งŒ๋“ค๊ธฐ โญ๏ธ 01. ์— ์ž‘์„ฑํ•˜๊ธฐ //์„ ํƒ์ž const searchBox = document.querySelector(".search__box input"); // input ๋ฐ•์Šค , ๊ฒ€์ƒ‰ ์˜์—ญ const searchList = document.querySelectorAll(".search__list ul li") // ๋ชฉ๋ก ๋ฆฌ์ŠคํŠธ //์†์„ฑ ๊ฐฏ์ˆ˜ ์„ค์ •ํ•˜๊ธฐ for(i=1; i { el.classList.add("show") }); // searchBox.addEventListener("keyup", () => { const searchWord = searchBox.value; // ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ํ‚ค์›Œ๋“œ searchList.forEach(el => { const cssName.. 2022. 8. 18.
search Effect (1) โญ๏ธ ๊ฒ€์ƒ‰์ฐฝ ๋งŒ๋“ค๊ธฐ โญ๏ธ 01. ์— ์ž‘์„ฑํ•˜๊ธฐ //์„ ํƒ์ž const searchBox = document.querySelector(".search__box input"); // input ๋ฐ•์Šค , ๊ฒ€์ƒ‰ ์˜์—ญ const searchList = document.querySelectorAll(".search__list ul li") // ๋ชฉ๋ก ๋ฆฌ์ŠคํŠธ const searchInfo = document.querySelector(".search__info .num") // ์ „์ฒด ๊ฐฏ์ˆ˜ // ์ „์ฒด ๊ฐฏ์ˆ˜ ๊ตฌํ•˜๊ธฐ searchInfo.textContent = searchList.length; // ๊ฒ€์ƒ‰ ์˜์—ญ searchBox.addEventListener("keyup", () => { const searc.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (9) includes ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( includes ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ๋ฉฐ, ์ด๋กœ์จ ๋ฉ”๋ชจ๋ฆฌ ๊ณต.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (8) indexOf / lastindexOf ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( indexOf / lastindexOf ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (7) padStart / padEnd ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( padStart / padEnd ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ๋ฉฐ, .. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (6) concat / repeat ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( concat / repeat ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ๋ฉฐ, ์ด๋กœ.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (5) replace / replaceAll ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( replace / replaceAll ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (4) split ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( split ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ๋ฉฐ, ์ด๋กœ์จ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์˜ .. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (3) slice / substring / substr ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( slice / substring / substr ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ.. 2022. 8. 18.
๋ฌธ์ž์—ด ๊ฐ์ฒด (2) toUpperCase / toLowerCase / trim / trimStart / trimEnd ๋ฉ”์„œ๋“œ โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( toUpperCase / toLowerCase / trim / trimStart / trimEnd ๋ฉ”์„œ๋“œ ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, .. 2022. 8. 18.
์ •๊ทœ ํ‘œํ˜„์‹ โญ๏ธ ์ •๊ทœ ํ‘œํ˜„์‹ โญ๏ธ 01. ์ •๊ทœ ํ‘œํ˜„์‹ (regex)์ด๋ž€? ์ •๊ทœ ํ‘œํ˜„์‹ (Regular Expression)์€ ์–ด๋– ํ•œ ํ…์ŠคํŠธ ๋‚ด์—์„œ ํŠน์ •ํ•œ ๊ทœ์น™์„ ๊ฐ€์ง„ ๋ฌธ์ž์—ด(ํŒจํ„ด)์„ ๊ฒ€์ƒ‰ํ•˜๊ณ  ์น˜ํ™˜ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ํ˜•์‹ ์–ธ์–ด๋ฅผ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ •๊ทœ ํ‘œํ˜„์‹์€ ๊ฒ€์ƒ‰ ์—”์ง„, ์›Œ๋“œ ํ”„๋กœ์„ธ์„œ์™€ ๋ฌธ์„œ ํŽธ์ง‘๊ธฐ์˜ ์ฐพ์•„ ๋ฐ”๊พธ๊ธฐ ๋Œ€ํ™”์ƒ์ž, ๊ทธ๋ฆฌ๊ณ  sed, AWK์™€ ๊ฐ™์€ ๋ฌธ์ž ์ฒ˜๋ฆฌ ์œ ํ‹ธ๋ฆฌํ‹ฐ, ์–ดํœ˜ ๋ถ„์„์— ์‚ฌ์šฉ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. [1] ์ •๊ทœ ํ‘œํ˜„์‹์˜ ํ˜•ํƒœ / regex / i / ์Šฌ๋ž˜์‹œ / ์•ˆ์— ์ฐพ๊ณ ์ž ํ•˜๋Š” ํŒจํ„ด regex ์„ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ์–ด๋–ค ์˜ต์…˜์— ์˜ํ•ด์„œ ๊ฒ€์ƒ‰ํ•  ๊ฒƒ์ธ์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ”Œ๋ž˜๊ทธ i ๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ํ”Œ๋ž˜๊ทธ(Expression Flags)์˜ ์ข…๋ฅ˜๋Š” global, multiline, case inse.. 2022. 8. 17.
๋ฌธ์ž์—ด ๊ฐ์ฒด (1) ๋ฌธ์ž์—ด ๊ฒฐํ•ฉ / ํ…œํ”Œ๋ฆฟ ๋ฌธ์ž์—ด โญ๏ธ ๋ฌธ์ž์—ด ๊ฐ์ฒด ( ๋ฌธ์ž์—ด ๊ฒฐํ•ฉ / ํ…œํ”Œ๋ฆฟ ๋ฌธ์ž์—ด ) โญ๏ธ 01. ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜ : ๋ฌธ์ž์—ด ๊ฐ์ฒด ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด(Standard Built-in Object)๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๊ฐ์ฒด๋“ค์„ ๋งํ•˜๋ฉฐ, ๋‹ค๋ฅธ ๊ฐ์ฒด์˜ ๊ธฐ์ดˆ๊ฐ€ ๋˜๋Š” ํ•ต์‹ฌ์ ์ธ ๊ฐ์ฒด ์ž…๋‹ˆ๋‹ค. ๋‚ด์žฅ ๊ฐ์ฒด์˜ ์ข…๋ฅ˜์—๋Š” Object, Fuction, String, Array, Math, Number, Event, Boolean, Data, RegExp ๋“ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ ์ค‘์—์„œ ๋ฌธ์ž์—ด ๊ฐ์ฒด(String Object)๋Š” ๋ฌธ์ž์—ด์„ ์ €์žฅ/๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๊ฐ์ฒด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ___ ์ฐธ๊ณ ํ•˜๊ธฐ ___ `1 ๋ฌธ์ž์—ด์„ ์ƒ์„ฑํ•  ๋•Œ๋Š” ''"" ๋”ฐ์˜ดํ‘œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜, new ํ‚ค์›Œ๋“œ๋ฅผ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. `2 ๋ฌธ์ž์—ด ๊ฐ์ฒด๋Š” ๋ถˆ๋ณ€์„ฑ์ด ์žˆ์œผ๋ฉฐ, ์ด๋กœ์จ ๋ฉ”.. 2022. 8. 17.
ํ€ด์ฆˆ ๋งŒ๋“ค๊ธฐ (5) ๊ฐ๊ด€์‹ ๋‹ค์ˆ˜ ๋ฌธํ•ญ โญ๏ธ ๊ฐ๊ด€์‹ ๋‹ค์ˆ˜ ๋ฌธํ•ญ (์ •๋‹ต ์˜ค๋‹ต ํ™•์ธ) โญ๏ธ 01. ๋งŒ๋“œ๋Š” ์ˆœ์„œ 1) ์ถœ๋ ฅํ•  ๋‚ด์šฉ์ด ๋“ค์–ด์žˆ๋Š” ์š”์†Œ ์„ ํƒํ•˜๊ธฐ 2) ์งˆ๋ฌธ๊ณผ ์ •๋‹ต ๋‚ด์šฉ, ํ•„์š”ํ•œ ๊ฐ’ ์ž…๋ ฅํ•˜๊ธฐ 3) ์งˆ๋ฌธ ๋‚ด์šฉ ์ถœ๋ ฅํ•˜๊ธฐ 4) ์ •๋‹ต ๋‚ด์šฉ ์ˆจ๊ฒจ๋†“๊ธฐ 5) ์ •๋‹ต ํ™•์ธ ๋ฐ ๊ฒฐ๊ณผ๊ฐ’ ์„ค์ •ํ•˜๊ธฐ 6) ์ •๋‹ต ๋ฒ„ํŠผ์˜ ๋™์ž‘ ์„ค์ •ํ•˜๊ธฐ 02. ์— ์ž‘์„ฑํ•˜๊ธฐ // ๋ฌธ์ œ ์ •๋ณด const quizInfo = [ { answerType: "์›น ๋””์ž์ธ ๊ธฐ๋Šฅ์‚ฌ (2014๋…„ 01ํšŒ)", answerNum: "1", answerAsk: "๋‹ค์Œ์˜ ๋””์ž์ธ ์›๋ฆฌ ์ค‘ ๋ฆฌ๋“ฌ์— ํ•ด๋‹น๋˜์ง€ ์•Š๋Š” ๊ฒƒ์€?", answerChoice: { 1: "์ ์ด", 2: "๊ฐ•์กฐ", 3: "๊ท ์ผ", 4: "์ ์ฆ", }, answerResult: "3", answerEx: "3๋ฒˆ // '๋ฆฌ๋“ฌ(์œจ๋™.. 2022. 8. 16.
728x90
๋ฐ˜์‘ํ˜•