숫자와 문자 강의 참고
출처 : https://opentutorials.org/course/743/4647
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <!DOCTYPE html> <html> <head> <title>javascript01</title> </head> <body> <script type = "text/javascript"> alert(1); alert(1.2 + 1.3); alert(2*5); alert(6/2); alert("coding everybody"); alert('coding==everybody'); alert( typeof "1"); alert( typeof 1); alert('wfox\'s javascript'); alert("안녕하세요 출출한 밤에는 떡볶이 입니다."); alert("떡볶이" + "순대"); alert("라볶이".length); </script> </body> </html> | cs |
alert( typeof "1"); 화면에 스트링으로 나온다.
alert( typeof 1); 화면에 number로 나온다.
1 2 3 4 5 6 | Math.pow(3,2); // 9, 3의 2승 Math.round(10.6); // 11, 10.6을 반올림 Math.ceil(10.2); // 11, 10.2를 올림 Math.floor(10.6); // 10, 10.6을 내림 Math.sqrt(9); // 3, 3의 제곱근 Math.random(); // 0부터 1.0 사이의 랜덤한 숫자 | cs |
참고 ) alert는 경고창 띄워주는 함수.
더해야할것. 자바스크립트 문자 + 숫자 타입 관련 자료 찾아서 포스팅 강화하기.
반응형
'프로그래밍 > Web' 카테고리의 다른 글
02. 변수 (0) | 2017.01.24 |
---|---|
[SVG] POLYGON HEX GRID 만들기. (0) | 2017.01.23 |
자바스크립트란? (0) | 2017.01.17 |
[jQuery] ready와 load의 차이. (0) | 2017.01.10 |
radio 버튼 checked (0) | 2015.12.04 |
댓글