๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ป/Nomadcoders

(3)
HTML Form input์˜ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ์ž‘๋™์‹œํ‚ค๊ธฐ ์œ„ํ•ด์„œ๋Š” input์ด form์•ˆ์— ์กด์žฌํ•ด์•ผ ํ•จ. input์„ form์•ˆ์— ์œ„์น˜์‹œ์ผฐ์„๋•Œ ์—”ํ„ฐ๋ฅผ ๋ˆ„๋ฅผ๋•Œ๋งˆ๋‹ค form์€ ์ž๋™์ ์œผ๋กœ submit form์•ˆ์˜ button ๋˜๋Š” type์ด submit์ธ input์„ ํด๋ฆญํ•˜๊ฑฐ๋‚˜ enter๋ฅผ ๋ˆ„๋ฅด๋ฉด ์ž‘์„ฑํ•œ form์ด "submit" submit์€ ์—”ํ„ฐ๋ฅผ ๋ˆ„๋ฅด๊ฑฐ๋‚˜ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•  ๋•Œ ๋ฐœ์ƒ > ๊ธฐ๋ณธ ๋™์ž‘์ธ ๋ธŒ๋ผ์šฐ์ € ์ƒˆ๋กœ๊ณ ์นจ > form submit ๊ธฐ๋ณธ ๋™์ž‘์„ ๋งž๋Š” ํ•จ์ˆ˜ preventDefault();
vanilla JS Challenges 2022/03/07~2022/03/21 ๊ฐ์ฒด ์•ˆ์— ๋ฉ”์„œ๋“œ ์„ ์–ธํ•˜๊ธฐ const object = { handleMousEnter: function(){ /// }, handleMouseLeave: function(){ /// } }; ์‚ฌ์šฉํ•œ Event - mouseenter, mouserleave, resize, contextmenu h2.addEventListener("mouseenter", superEventHandler.handleEnter); h2.addEventListener("mouseleave", superEventHandler.handleLeave); window.addEventListener("resize", superEventHandler.handleResize); window.addEventListener("contextmen..
[React JS] Arrow function์ด๋ž€? โ–ถ ํ™”์‚ดํ‘œ ํ•จ์ˆ˜(Arrow function) var/let/const ํ•จ์ˆ˜๋ช… = (๋งค๊ฐœ๋ณ€์ˆ˜) => {์‹คํ–‰๋ฌธ} : ์ผ๋ฐ˜ ํ•จ์ˆ˜ ํ‘œํ˜„์‹๋ณด๋‹ค ๋‹จ์ˆœํ•˜๊ณ  ๊ฐ„๊ฒฐํ•œ ๋ฌธ๋ฒ• : return ๋ช…๋ น์–ด ์—†์ด๋„ ํ•จ์ˆ˜ ์‹คํ–‰์„ ์ข…๋ฃŒ์‹œํ‚ค๊ณ  ๊ฐ’์„ ๋ฐ˜ํ™˜. : ์ต๋ช…ํ•จ์ˆ˜, ํ•จ์ˆ˜๋ฅผ ์žฌ์‚ฌ์šฉํ•˜์ง€ ์•Š์„ ๋ชฉ์ ์œผ๋กœ ํ•จ์ˆ˜์— ์ด๋ฆ„์„ ๋ถ™์ด์ง€ ์•Š๋Š” ๊ฒƒ. // ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ var foo = () => console.log('bar'); // ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ํ•˜๋‚˜์ธ ๊ฒฝ์šฐ var foo = x => x; // ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ์—ฌ๋Ÿฌ๊ฐœ์ธ ๊ฒฝ์šฐ var foo = (a, b) => a + b; // ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•œ์ค„๋กœ ํ‘œํ˜„ํ•  ๋• "{}" ์—†์ด ๊ฐ’์ด ๋ฐ˜ํ™˜๋ฉ๋‹ˆ๋‹ค. var foo = (a, b) => { return a + b }; // "{}" ์‚ฌ์šฉ > ๋ฆฌํ„ด ์กด์žฌ var foo ..