본문 바로가기
728x90
320x100
SMALL
[JAVAScript]시간 세는 setTimeout, setInterval 2022. 12. 19.
[JAVAScript]매개변수 이름과 직위를 입력하여 환영 인사말을 출력해 보세요. 놀러오세요~ 2022. 12. 19.
[JAVAScript]지역변수, 전역변수 var bun = 100000; //전역변수 function f(){ var bun=1; //지역변수 document.write("지역변수 bun="+bun+" "); document.write("전역변수 bun="+ this.bun +" "); } f();//호출 var n = 15; document.write(n+" "); var nn = 015; document.write(nn+" "); var nnn = 0x15; document.write(nnn+" "); 2022. 12. 16.
[JAVAScript] document.write 잘뜸 ‘\n'은 빈칸하나 의미 document.write() 활용 조건문, for문 다 가능 잘돌아가는 것을 알 수 있다 input = prompt("숫자를 입력하세요","35000"); x = parseInt(input); input = prompt("숫자를 입력하세요","35000"); y = parseInt(input); sum= x+y; document.write("x의 값은"+x+"y의 값은"+y+"총값은"+sum);; input = prompt("데이터입력(덧셈1,뺄셈2,곱셈3,나눗셈4)","1"); select = parseInt(input); input = prompt("숫자를 입력하세요","35000"); x = parseInt(input); input = prompt("숫자를 입력하세요.. 2022. 12. 16.
[JAVAScript] alert창, 글씨쓰기, 외부창 마우스 올려 보세요 잘됨 이거 한줄 넣어주면 끝~ 2022. 12. 16.
[JAVAScript/자바스크립트]if, else, else if, for, forin, switch, continue, break 조건문 if 참일경우 실행 else 동일 조건이 false인경우 실행 else if 첫번째 조건이 false인경우 새 조건 지정해서 테스트 switch 실행할 많은 대체 코드 블록을 지정할때 if (condition1) { // block of code to be executed if condition1 is true } else if (condition2) { // block of code to be executed if the condition1 is false and condition2 is true } else { // block of code to be executed if the condition1 is false and condition2 is false } 대문자 IF를 사용시 오류 발생 .. 2022. 10. 12.
[JAVAScript/자바스크립트]수학, 랜덤, 삼항 연산자 Math 다른 객체와 달리 생성자가 없음 정적임 먼저 생성하지 않고도 모든 메서드의 속성을 사용가능 상수(property) Math.property Math.E // returns Euler's number Math.PI // returns PI Math.SQRT2 // returns the square root of 2 Math.SQRT1_2 // returns the square root of 1/2 Math.LN2 // returns the natural logarithm of 2 Math.LN10 // returns the natural logarithm of 10 Math.LOG2E // returns base 2 logarithm of E Math.LOG10E // returns base 10.. 2022. 10. 12.
[JAVAScript/자바스크립트]날짜 date const date = new Date(); // 생성 날짜 생성 기본적으로 브라우저 시간대를 사용하고 날짜를 전체 텍스트 문자열로 표시 새 날짜 객체 만드는법 new Date() // 현재 날짜와 시간으로 객체 생성 new Date(year, month, day, hours, minutes, seconds, milliseconds) // 지정된 날짜 및 시간으로 만듬 // 참고로 1월은 0임 // 6개 년월일시분초//5개년월일시분//4개년월일시//3연월일//2년월 지정 new Date(milliseconds) 자바스크립트는 날짜를 밀리초로 저장 new Date(date string) 날짜 표시 여기에다가 date.toString()을 넣으면 자동으로 문자열로 반환 toUTCString()은 날.. 2022. 10. 12.
[JAVAScript/자바스크립트]템플릿 리터럴,백틱,숫자,배열 템플릿 리터럴(백틱) 따옴표 대신 역따옴표를 사용해 문자열을 정의함 역따옴표를 백틱이라함 템플릿 리터럴 사용시 문자열 내 작은따옴표와 큰따옴표를 모두사용가능 백틱사이에는 줄바꿈을 \n을 안쳐줘도 먹음 보간(interpolation) 템플릿 리터럴을 사용하면 변수와 식을 문자열로 쉽게 보간할 수 있음 ${...} 변수대체 템플릿 리터럴은 문자열에 변수를 허용함 변수를 실제 값으로 자동 교체하는 것을 문자열보간이라고함 name+"님 안녕하세요" 랑 `${name}님 안녕하세요` 랑 같은거임 숫자 소수, 정수 가능 소수는 지수표기법으로 작성가능(ex> 123e2 = 12300) 지수표기법이 없는 숫자는 최대 15자리까지 가능한데 최대 소수자릿수는 17임 +기호 더하기와 연결 모두 사용하기때문에 문자를 더하게 .. 2022. 10. 12.
728x90
반응형
BIG