Programming
-
코딩애플 JavaScript 입문과 웹 UI개발 Lv2(b)Programming/Web 2022. 11. 25. 04:13
function - 긴 코드 짧게 축약해서 쓸 수 있다 - 파라미터로 기능업그레이드 가능하다 - return 을 서서 함수쓰고나서 그 값 자리에 둘 수 있다 return 만나면 함수는 그 자리에서 종료 , 뒷 코드는 실행되지 않는다. * JS에서 소수점 연산시 주의점 컴퓨터는 2진법 설계로 아주 작은 오차가 발생한다. . 해결 위해서는 1. 덧셈하기 전에 10곱해서 덧셈하고 10으로 나누기 2. 외부라이브러리 3. 반올림 ( 대부분 ) 숫자 . toFixed(몇자리) toFixed 반올림 문제점 : 문자로 변환된다. 후에 숫자로 변환 필요하다. parseFloat(' ') parseInt(' ') function toSec(h,m){ var sec=h*60*1000+1000*m; return sec; }..
-
코딩애플 JavaScript 입문과 웹 UI개발 Lv2(a)Programming/Web 2022. 11. 24. 14:14
let age=22; const area=korea; var 예금액 = 60000; var 미래예금액 = 0; if 예금액 그러네 1.2를 곱하면 되는거지 바보야 ^^.. b=1.2a+0.2*1.2a 그냥 1.2*1.2*a하면 되는거지 ^!^ 이게 뭐하는거야 문제 4. var first=360; 360+360*0.6+360*0.6*0.6 a+0.6a+0.6**2a 무한등비수열의 합 그렇다고 한다. 한때 수학 좋아했었는데, 그 말이 무색하게 다까먹었다. 문제5. 태조 이성계가 태어난 년도는? 제출 답안에서는 1335 문자취급함. 꼭 해야하는가? setTimeout 타이머 주는 법 x초 후 코드 실행하려면 setTimeout( function(){실행할코드}, ms) 콜백함수, 초단위로 쓰기 setTimeo..
-
코딩애플 JavaScript 입문과 웹 UI개발 Lv1(b)Programming/Web 2022. 11. 24. 00:07
전송 버튼은 type="submit" 일반 버튼 type="button" form 쓰는 이유 : 서버로 유저정보 전송하려고 쓰는 것임 전송하려면 form action="url" 을 써주면 된다. success.html 파일 만들기. form action="success.html" if (조건) { 실행할 코드 console.log('hi') } else { } form 전송시 submit 이벤트도 작성함 그래서 onclick 말고 폼태그를 찾고 $('form').on('submit', function(){ 이렇게 작성해도 그 전과 똑같음 *나의 오류 : input의 값을 가져와야 하는데 그저 input태그를 가져옴! jqeury input값 : $(' a ').val() 오잉.. 여전한 null 대신 '..
-
코딩애플 JavaScript 입문과 웹 UI개발 Lv1(a)Programming/Web 2022. 11. 23. 21:31
1. document.getElementById('hello').innerHTML = '안녕'; html 문서 의 id가 hello인 html 요소를 가져와라. 그거의 내부 html 을 안녕으로 바꿔라 = 등호 : 오른쪽을 왼쪽에 넣으라는 뜻 document.getElementById('??').??='??'; ?? 1. 바꿀 html요소 id 2. 무엇을 3. 어떻게 getElementById = 셀렉터 : 문서에서 원하는 요소 찾는 것 5분 숙제 : 글자 폰트 사이즈 16px로 줄이기 by JS document.getElementById('hello').style.font-size=16px; 폰트 변경안됨 >> font-size => fontSize document.getElementById('hel..