728x90
반응형

function 15

[ jQuery ] How to prevent the modal from closing when using the data picker while using the bootstrap model.

On the page, a datepicker is used in the element using the modal. There was a problem that the modal was closed every time I clicked on a date on the datepicker's calendar. $('#test').datepicker({ format: "yyyy-mm-dd", autoclose: true }); The above code is an existing code with datepicker set. Below is a code to prevent the modal from closing when the date is selected with the datepicker in the ..

javascript 2022.01.12

[ Python ] 전역변수와 지역변수

지역변수와 전역변수 # 지역변수 : 함수 내에서만 사용 가능. # 함수 호출되면 만들어졌다가 함수 호출이 끝나면 사라지는 변수. # 전역변수 : 프로그램 모든 공간 어디에서든 불러서 사용할 수 있는 변수. # 예시 : 군대 gun = 10 def checkPoint(soldiers): global gun # 전역 공간에 있는 gun 사용 gun = gun - soldiers print("[함수 내] 남은 총 : {0}".format(gun)) # 일반적으로 전역 변수를 사용하면 코드 관리가 어려워서 권장하진 않는다. (global gun) # 가급적 함수의 전달 값으로 던져서 반환값을 받아서 사용한다. def checkPoint_ret(gun, soldiers): gun = gun - soldiers p..

Python 2021.03.06

[ Python ] 가변 인자 사용법. (*language)

'가변 인자'를 이용한 함수 호출 # 끝에 end=" " 이렇게 입력해주면 다음 출력이 줄바꿈 되지 않고 이어서 출력된다. # 방법1 # def profile(name, age, lang1, lang2, lang3, lang4, lang5): # print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ") # print(lang1, lang2, lang3, lang4, lang5) # lang1,2,3,4,5 -> *language 로 수정 def profile(name, age, *language): # 가변 인자 print("이름 : {0}\t나이 : {1}\t".format(name, age), end=" ") for lang in langua..

Python 2021.03.06

[ Python ] 함수 매개변수의 기본값(default) 설정

기본값 # 코드 줄바꿈을 할 때는 \ 입력하고 enter해서 이어서 쓰면 된다. # -------- 아래 코드를 실행하기 위한 주석처리 --------- # def profile(name, age, main_lang): # print("이름 : {0}\t나이 : {1}\t주 사용 언어 : {2}" \ # .format(name, age, main_lang)) # profile("유재석", 30, "파이썬") # profile("김태호", 20, "자바") # 같은 나이라면 나이, 주 언어(수업)를 하나하나 입력해줄 필요가 없다. # 같은 학교 같은 학년 같은 반 같은 수업. # 기본값 : 위와 같은 경우에 사용하는 것이 기본값. def profile(name, age=17, main_lang="파이썬")..

Python 2021.03.06

[ javascript ] 자바스크립트 매번 다른 함수 호출 방법 예제(함수 활용 2가지 방법)

console.clear(); function hello(mode) { var msg = '안녕하세요.'; if ( mode == '일본어' ) { msg = '곤니찌와'; } else if ( mode == '영어' ) { msg = '헬로'; } console.log(msg); } hello('한국어'); hello('일본어'); hello('영어'); var hello22 = function(mode) { var msg = '안녕하세요.'; if ( mode == '일본어' ) { msg = '곤니찌와'; } else if ( mode == '영어' ) { msg = '헬로'; } console.log(msg); } hello22('한국어'); hello22('일본어'); hello22('영어');

javascript 2020.10.13

[ javascript ] 자바스크립트 함수 활용 구구단 만들기 예제

html css body, a { margin: 0; padding: 0; text-decoration: none; } .dan { font-size:3rem; font-weight:bold; color:red; } .limit { font-size:1.8rem; font-weight:bold; } javascript console.clear(); // 예제 3-1개 //var $test = $('.test'); //$test.append('안녕하세요'); var dan = function(dan) { var $dan = $('.dan'); $dan.append('구구단 ' + dan + '단'); } var limit = function(limit) { var num = 8; dan(num); var ..

javascript 2020.10.13
728x90
반응형
LIST