Bibi's DevLog ๐Ÿค“๐ŸŽ

[์ธํ”„๋Ÿฐ] Javascript์ž…๋ฌธ - ๊ตฌ๊ตฌ๋‹จ 2, 3๋‹จ ๊ณ„์‚ฐ ๋ฐ ์ถœ๋ ฅ & ์ฝ”๋”ฉ ๊ตฌํ˜„ ๋ณธ๋ฌธ

ํ”„๋กœ๊ทธ๋ž˜๋ฐ/Javascript ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ

[์ธํ”„๋Ÿฐ] Javascript์ž…๋ฌธ - ๊ตฌ๊ตฌ๋‹จ 2, 3๋‹จ ๊ณ„์‚ฐ ๋ฐ ์ถœ๋ ฅ & ์ฝ”๋”ฉ ๊ตฌํ˜„

๋น„๋น„ bibi 2020. 10. 7. 16:09
* ์ด ๊ธ€์€ ์ธํ”„๋Ÿฐ์—์„œ ์ œ๊ณตํ•˜๋Š” ํ˜ธ๋ˆ…์Šค๋‹˜์˜ ์œ ๋ฃŒ ๊ฐ•์˜ '์‰ฝ๊ณ  ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ฐฐ์›Œ๋ณด๋Š” Javascript ์ž…๋ฌธ - ์ฝ”๋“œ์Šค์ฟผ๋“œ ๋งˆ์Šคํ„ฐ์ฆˆ ์ฝ”์Šค ๋ ˆ๋ฒจ1'๋ฅผ ๋“ฃ๊ณ  ๊ณต๋ถ€ํ•˜๋ฉฐ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๊ฐ•์˜ ๋‚ด์šฉ์— ๋”ํ•ด, ์ œ๊ฐ€ ํ•„๊ธฐํ•˜๊ณ  ๊ตฌ๊ธ€๋งํ•œ ๋‚ด์šฉ์ด ์ •๋ฆฌ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ดˆ๋ณด์ธ ์ œ๊ฐ€ ์ดํ•ดํ•œ ๋Œ€๋กœ ์ •๋ฆฌํ–ˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋ถ€์ •ํ™•ํ•œ ๋‚ด์šฉ์ด ์žˆ์„ ์ˆ˜ ์žˆ์Œ์„ ๊ฐ์•ˆํ•ด ์ฃผ์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค. ๊ฐ•์˜๋ฅผ ๋“ฃ๊ณ  ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ด๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ์ธํ”„๋Ÿฐ ์ธก ๋‹ต๋ณ€์„ ๋ฐ›์€ ์ ์ด ์žˆ์œผ๋‚˜(https://bibi6666667.tistory.com/37), ์ €์ž‘๊ถŒ์ƒ ๋ฌธ์ œ๊ฐ€ ๋œ๋‹ค๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ(๋น„๊ณต๊ฐœ)๋กœ ์ „ํ™˜ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

ํ•™์Šต ๋ชฉํ‘œ

  • 4์น™์—ฐ์‚ฐ ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•ด ๋ณธ๋‹ค.
  • ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•ด ์ฝ˜์†”์— ๊ฐ’์ด ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ์„ ๊ฒฝํ—˜ํ•œ๋‹ค.
  • ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•ด html์— ๊ฐ’์ด ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ์„ ๊ฒฝํ—˜ํ•œ๋‹ค.
  • github์— ํ”„๋กœ์ ํŠธ๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ์›น์—์„œ ํ™•์ธํ•œ๋‹ค.
  • ์˜์–ด ํƒ€์ดํ•‘์„ ์—ฐ์Šตํ•œ๋‹ค. - 200~300ํƒ€๋Š” ๋˜๋„๋ก.

์š”๊ตฌ์‚ฌํ•ญ

  • ๊ตฌ๊ตฌ๋‹จ์—์„œ 2๋‹จ๊ณผ 3๋‹จ์„ ๊ณ„์‚ฐํ•˜๊ณ  ํ™”๋ฉด์— ์ถœ๋ ฅํ•œ๋‹ค.
  • ์˜ˆ๋ฅผ ๋“ค์–ด 2๋‹จ์€ 2 ๊ณฑํ•˜๊ธฐ 1 ๊ณ„์‚ฐํ›„ ๊ณ„์‚ฐ ๊ฐ’์„ ์ถœ๋ ฅ, 2 ๊ณฑํ•˜๊ธฐ 2 ๊ณ„์‚ฐ ํ›„ ๊ณ„์‚ฐ ๊ฐ’์„ ์ถœ๋ ฅ ... 2๊ณฑํ•˜๊ธฐ 9๊นŒ์ง€ ๋ฐ˜๋ณต. 3๋‹จ์€ ๊ฐ™์€ ๊ณผ์ •์„ ๋ฐ˜๋ณต
  • ํ”„๋กœ๊ทธ๋žจ 1: ์ฒ˜์Œ์—๋Š” ์ฝ˜์†”์— ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•œ๋‹ค.
  • ํ”„๋กœ๊ทธ๋žจ 2: ๋‘๋ฒˆ์งธ๋Š” html ํ™”๋ฉด์— ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•œ๋‹ค.
  • ๊ฐ ํ”„๋กœ๊ทธ๋žจ ์ž‘์„ฑํ›„ ์ปค๋ฐ‹์„ ํ•œ๋‹ค.

****************
๋™์˜์ƒ์„ ๋‘˜๋กœ ๋‚˜๋ˆŒ ๊ฒƒ.
์ด๋ ‡๊ฒŒ ๊ณผ์ œ๋ฅผ ์•ˆ๋‚ดํ•˜๋Š” ์˜์ƒ(1)๊ณผ
๋ผ์ด๋ธŒ ์ฝ”๋”ฉ ์˜์ƒ(2)

(1)์„ ๋ณธ ๋’ค,
์Šค์Šค๋กœ ๋ฌธ์ œ๋ฅผ ํ’€์–ด๋ณด๊ณ  ๋‚˜์„œ, ์ž˜ ์•ˆ ๋˜๊ฑฐ๋‚˜ ๋„์›€์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ 
ํ˜น์€ ๋‹ค ํ’€์–ด๋ณธ ๋’ค ์„ ์ƒ๋‹˜์€ ๋‚˜์™€ ๋‹ค๋ฅด๊ฒŒ ์–ด๋–ป๊ฒŒ ์ฝ”๋”ฉํ–ˆ๋Š”์ง€ ๋ณด๊ธฐ ์œ„ํ•ด์„œ (2)๋ฅผ ๋ณด๋ฉด ๋œ๋‹ค.

๊ฒฐ๊ณผ๋ฌผ

  • gugudan1.html ๊ณผ gugudan2.html ์„ ์ปค๋ฐ‹ํ•œ ์ €์žฅ์†Œ

ํžŒํŠธ

  • ๊ตฌ๊ธ€์—์„œ "ํ”„๋กœ๊ทธ๋ž˜๋ฐ 4์น™ ์—ฐ์‚ฐ"์™€ ๊ฐ™์€ ํ‚ค์›Œ๋“œ๋กœ ๊ฒ€์ƒ‰ํ•ด ๊ณฑ์…ˆ ๋ฐฉ๋ฒ•์„ ์ฐพ์•„ ๊ตฌํ˜„ํ•œ๋‹ค.
  • ๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ console.log()๋ฅผ ์ด์šฉํ•ด ์ถœ๋ ฅํ•œ๋‹ค.
  • ๊ณ„์‚ฐ ๊ฒฐ๊ณผ๋ฅผ document.write()๋ฅผ ์ด์šฉํ•ด ์ถœ๋ ฅํ•œ๋‹ค.
  • html ์ค„๋ฐ”๊ฟˆ ํƒœ๊ทธ๋ฅผ ๊ฒ€์ƒ‰ํ•ด ๋ณธ๋‹ค.

์œ ์šฉํ•œ ๋‹จ์ถ•ํ‚ค

๊ฐ์ž์˜ ์—๋””ํ„ฐ์— ๋น„์Šทํ•œ ๊ธฐ๋Šฅ์ด ์žˆ์œผ๋‹ˆ, ๊ฒ€์ƒ‰ํ•ด ๋ณด๊ณ  ์‚ฌ์šฉ๋ฒ•์„ ์ตํžˆ์ž.

  • ํ•œ ์ค„ ๋ณต์‚ฌํ•˜๊ธฐ: shift + alt + ์•„๋ž˜ ํ™”์‚ดํ‘œ

ํ•™์Šต ์ฐธ๊ณ  ๊ฐ•์ขŒ - ์ƒํ™œ์ฝ”๋”ฉ WEB2 Javascript 6.๋ฐ์ดํ„ฐํƒ€์ž… - ๋ฌธ์ž์—ด๊ณผ ์ˆซ์ž

www.youtube.com/watch?v=P8C8VNiM33A&feature=youtu.be

 

๋ณด๊ณ  ์ •๋ฆฌํ•œ ๋‚ด์šฉ :

2020/10/07 - [Keep Going!/Javascript ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] - ์ฐธ์กฐ ๊ฐ•์ขŒ ) ์ƒํ™œ์ฝ”๋”ฉ WEB2 Javascript 6.๋ฐ์ดํ„ฐํƒ€์ž… - ๋ฌธ์ž์—ด๊ณผ ์ˆซ์ž

 

์ฐธ์กฐ ๊ฐ•์ขŒ ) ์ƒํ™œ์ฝ”๋”ฉ WEB2 Javascript 6.๋ฐ์ดํ„ฐํƒ€์ž… - ๋ฌธ์ž์—ด๊ณผ ์ˆซ์ž

โ€ป์ด ๋ฌธ์„œ๋Š” bibi6666667.tistory.com/54 ์˜ ์ฐธ์กฐ ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค. [์ธํ”„๋Ÿฐ] Javascript์ž…๋ฌธ - ๊ตฌ๊ตฌ๋‹จ 2, 3๋‹จ ๊ณ„์‚ฐ ๋ฐ ์ถœ๋ ฅ & ์ฝ”๋”ฉ ๊ตฌํ˜„ ๋น„๋น„์˜ ์ดˆ์› Bibi's grasslandโ›บ [์ธํ”„๋Ÿฐ] Javascript์ž…๋ฌธ - ๊ตฌ๊ตฌ๋‹จ 2, 3๋‹จ ๊ณ„..

bibi6666667.tistory.com


 

์ฝ”๋”ฉ ๊ตฌํ˜„

console.log ๋ฒ„์ „ (2๋‹จ, 3๋‹จ)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>๊ตฌ๊ตฌ๋‹จ - 2๋‹จ๊ณผ 3๋‹จ ์ถœ๋ ฅํ•˜๊ธฐ</h2>
<script>
    console.log('๊ตฌ๊ตฌ๋‹จ : 2๋‹จ ์ž…๋‹ˆ๋‹ค.');
    console.log('2 * 1 = ' + 2 * 1);
    console.log('2 * 2 = ' + 2 * 2);
    console.log('2 * 3 = ' + 2 * 3);
    console.log('2 * 4 = ' + 2 * 4);
    console.log('2 * 5 = ' + 2 * 5);
    console.log('2 * 6 = ' + 2 * 6);
    console.log('2 * 7 = ' + 2 * 7);
    console.log('2 * 8 = ' + 2 * 8);
    console.log('2 * 9 = ' + 2 * 9);

    console.log('๊ตฌ๊ตฌ๋‹จ : 3๋‹จ ์ž…๋‹ˆ๋‹ค.');
    console.log('3 * 1 = ' + 3 * 1);
    console.log('3 * 2 = ' + 3 * 2);
    console.log('3 * 3 = ' + 3 * 3);
    console.log('3 * 4 = ' + 3 * 4);
    console.log('3 * 5 = ' + 3 * 5);
    console.log('3 * 6 = ' + 3 * 6);
    console.log('3 * 7 = ' + 3 * 7);
    console.log('3 * 8 = ' + 3 * 8);
    console.log('3 * 9 = ' + 3 * 9);


</script>
</body>
</html>

 

document.write ๋ฒ„์ „ (2๋‹จ, 3๋‹จ)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>๊ตฌ๊ตฌ๋‹จ - 2๋‹จ๊ณผ 3๋‹จ ์ถœ๋ ฅํ•˜๊ธฐ</h2>
<script>
    document.write('<h3>๊ตฌ๊ตฌ๋‹จ : 2๋‹จ ์ž…๋‹ˆ๋‹ค.</h3>');
    document.write('2 * 1 = ' + 2 * 1 + '<br>');
    document.write('2 * 2 = ' + 2 * 2 + '<br>');
    document.write('2 * 3 = ' + 2 * 3 + '<br>');
    document.write('2 * 4 = ' + 2 * 4 + '<br>');
    document.write('2 * 5 = ' + 2 * 5+ '<br>');
    document.write('2 * 6 = ' + 2 * 6+ '<br>');
    document.write('2 * 7 = ' + 2 * 7+ '<br>');
    document.write('2 * 8 = ' + 2 * 8+ '<br>');
    document.write('2 * 9 = ' + 2 * 9+ '<br>');

    document.write('<h3>๊ตฌ๊ตฌ๋‹จ : 3๋‹จ ์ž…๋‹ˆ๋‹ค.</h3>');
    document.write('3 * 1 = ' + 3 * 1+ '<br>');
    document.write('3 * 2 = ' + 3 * 2+ '<br>');
    document.write('3 * 3 = ' + 3 * 3+ '<br>');
    document.write('3 * 4 = ' + 3 * 4+ '<br>');
    document.write('3 * 5 = ' + 3 * 5+ '<br>');
    document.write('3 * 6 = ' + 3 * 6+ '<br>');
    document.write('3 * 7 = ' + 3 * 7+ '<br>');
    document.write('3 * 8 = ' + 3 * 8+ '<br>');
    document.write('3 * 9 = ' + 3 * 9+ '<br>');


</script>
</body>
</html>

 

์•Œ์•„๋‘ฌ์•ผ ํ•  ๋‚ด์šฉ - ์—๋””ํ„ฐ ๋‹จ์ถ•ํ‚ค๋ฅผ ํ™œ์šฉํ•ด ๋” ๋น ๋ฅด๊ณ  ํšจ์œจ์ ์œผ๋กœ ์ฝ”๋”ฉํ•˜๊ธฐ.

ํŒŒ์ด์ฐธ ๋‹จ์ถ•ํ‚ค

- ์ฐธ๊ณ  (roby.tistory.com/entry/%ED%8C%8C%EC%9D%B4%EC%B0%B8Pycham-%EB%8B%A8%EC%B6%95%ED%82%A4)

** ์ฝ”๋“œ ํ•œ ์ค„ ์•„๋ž˜์— ๋ณต๋ถ™ ๋‹จ์ถ•ํ‚ค = Ctrl + d 
** ๋ธ”๋Ÿญ ๋‹จ์œ„ ์„ ํƒ = ctrl + w

**์ฐพ๊ธฐ(๋ฐ ๋ฐ”๊พธ๊ธฐ), ( Ctrl + F | Ctrl + H )

**์ฐพ๊ธฐ ๋ฐ ๋ฐ”๊พธ๊ธฐ์˜ ๊ธฐ๋ณธ ๋‹จ์ถ•ํ‚ค๋Š” Ctrl + R ์ด๋‹ค(Replace).