본문 바로가기

분류 전체보기278

자바스크립트 간단한 클래스 무제 문서 // Person 클래스를 정의합니다. class Person { // constructor 메소드는 객체를 생성할 때 자동으로 호출됩니다. constructor(name, age) { this.name = name; // name 속성을 설정합니다. this.age = age; // age 속성을 설정합니다. } // sayHello 메소드를 정의합니다. sayHello() { console.log(`안녕하세요, 저는 ${this.name}입니다.`); } } // Person 클래스를 이용하여 객체를 생성합니다. const person1 = new Person("홍길동", 20); const pers.. 2023. 3. 23.
화살표 함수 예시4 Counter let sum = (a, b) => a + b;document.write(sum(8, 2))let mul = function(a, b) { return a * b;};document.write(mul(3, 5)); 2023. 3. 16.
화살표 함수 예시3 Document /* const a = { b: 'b', c: () => { document.write(this.b)} } a.c() // undefined*/ const a = { b: 'b', c: function(){ document.write(this.b)} } a.c()// b // 위아래 객체의 c 메서드는 같은 내용입니다. 표기법만 다른것입니다./* const a = { b: 'b', c() { document.write(this.b)} } a.c()// b*/ 2023. 3. 15.
화살표 함수 예시2 Document /* const btn = document.querySelector("#button"); function display() { alert("클릭했습니다."); } btn.addEventListener("click", display); //버튼을 클릭하면 display 함수 실행*/ const btn = document.querySelector("#button"); btn.addEventListener("click", () => { alert("클릭했습니다.") }) 2023. 3. 15.
화살표 함수 예시1 Document function showAsk(message, yes, no) { if (confirm(message)) yes(); else no(); } showAsk("가입하시겠습니다.", () => {alert("가입 동의")}, () => {alert("가입 미동의")}); /* var message = confirm("가입하시겠습니까?") if (message == true){ alert("가입 동의"); }else{ alert("가입 미동의"); } */ 2023. 3. 15.
Notion AI가 만든 파이썬 벽돌깨기 소스 import pygame import random # 화면 크기 설정 SCREEN_WIDTH = 480 SCREEN_HEIGHT = 640 # 색상 설정 WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) # 게임 관련 변수 설정 BALL_SPEED = 0.1 PAD_SPEED = 0.5 BRICK_WIDTH = 60 BRICK_HEIGHT = 20 BRICK_GAP = 10 BRICK_ROWS = 5 BRICK_COLS = 8 LEVELS = 3 LIVES = 3 # 게임 초기화 pygame.init() screen = pygame.display.set_mode((SCREEN_W.. 2023. 2. 28.
Notion AI 노션에서도 AI가 나왔네요. 1. 노션에 들어가면 안보이는 새로운 글자가 보입니다. AI로 글쓰기 시작 스페이스 바를 누르면 AI기능이 나옵니다. 2. AI에게 요청할 메뉴를 고를 수 있습니다. 더 보기를 누르면 더 많은 메뉴를 볼 수 있습니다. 3. 파이썬에게 벽돌깨기 소스를 물어 봤습니다. 4. 결과 ① - 아래는 파이썬으로 만들어진 벽돌깨기 게임 소스코드입니다. import pygame import sys import math import random # Initialize pygame pygame.init() # Set screen dimensions screen_width = 640 screen_height = 480 # Create the screen screen = pygame.display.set_mode((scree.. 2023. 2. 27.
Notion에서 활용 가능한 폼 Tally 가입하기 노션에서 활용 가능한 폼 Tally 가입하기 탈리사이트 접속 https://tally.so/ Free Online Form Builder | Tally Tally is the simplest way to create free forms & surveys. Create any type of form in seconds, without knowing how to code, and for free. tally.so 1. Sign up 눌러주세요 2. 이름, 성, 이메일, 비밀번호를 적어줍니다.(회원가입 적을 내용이 간단하죠) 3. 이메일로 인증번호가 옵니다. 탈리사이트에 인증번호를 넣어 줍니다. 4. 로그인(log in)을 눌러서 들어갑니다. 5. 탈리 폼을 만들 수 있는 페이지가 바로 나옵니다.(노션과 느낌.. 2023. 2. 8.
반응형