Javascript (35) 썸네일형 리스트형 Date 객체 사용하기 See the Pen xxGYEpr by MoonSeonhyeon (@Seonhyeon) on CodePen. Math 객체 만들기 수학 계산을 위한 프로퍼티와 메소드 제공 new Math()로 객체 생성하지 않고도 사용 Math 객체의 메소드 random() floor() 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Document //랜덤하게 1~9까지 리턴하는 함수만들기 function randomInt(){ return Math.floor(Math.random()*9)+1; } Math 객체 만들기 var q = randomInt() + "*" + randomInt(); var u = prompt(q + "값은 얼마입니까?", "0"); //취소를 클릭하면 u값은 null이 된다. if(u==null){ d.. 배열 Array(예시 평균 온도 구하기, 배열 다음 for문) 평균 온도 구하기 See the Pen VwLQKLz by MoonSeonhyeon (@Seonhyeon) on CodePen. 배열 다음 for문 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 package myapp; public class Ex2 { public static void main(String[] args) { // 배열 : 동일한 타입의 값들을 하나의 변수 사용하기 위한 목적(아파트) int arr[] = {1,2,3,4,5}; System.out.println(arr[0]); System.out.println(arr[1]); //배열 밑에는 항상 for가 있다(JSPStudy) for (int i = 0; i cs 객체 , 클래스 // object, class See the Pen zYGRKxr by MoonSeonhyeon (@Seonhyeon) on CodePen. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 package myapp; public class Ex1 { public static void main(String[] args) { // 클래스 만들기 -> 클래스 생성 ->클래스 사용 (변수, 메소드) //SUN에서 잘 만들어놓은 클래스들 갖다 사용. 아래에는 String 클래스(SUN 회사에서 제공) 생성 //레퍼런스 변수 : s는 만들어진 객체를 가르키고 있는 변수 String s = new String("하하하하하하하하하"); //String은 문자열을 객체화한 클래스 //레퍼런스 변수.변수.. 함수 function / isNaN, parseInt 더하기 See the Pen xxGYwQZ by MoonSeonhyeon (@Seonhyeon) on CodePen. See the Pen XWbZmoW by MoonSeonhyeon (@Seonhyeon) on CodePen. 구구단 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Document function gugudan(n) { m = parseInt(n); if(isNaN(m)||m9){ alert("잘못 입력하셨습니다."); return;//밑에 코드가 실행되지 않고 함수를 빠져나감 break랑 비슷. } for (i=1;ics break ,continue See the Pen qBdpKPg by MoonSeonhyeon (@Seonhyeon) on CodePen. See the Pen rNVpKpK by MoonSeonhyeon (@Seonhyeon) on CodePen. while문 으로 0에서 n까지 합/do-while문 while문 으로 0에서 n까지 합 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 while문으로 0에서 n까지 합 http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs do-while문 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Document do-while문 //1에서 10까.. 반복문 for문, 중첩 (예시 구구단 만들고 css로 꾸미기까지~!) See the Pen MWwrXvr by MoonSeonhyeon (@Seonhyeon) on CodePen. See the Pen JjdMZJw by MoonSeonhyeon (@Seonhyeon) on CodePen. 반복문 중첩 See the Pen rNVpKpK by MoonSeonhyeon (@Seonhyeon) on CodePen. 구구단 만들고 css로 꾸미기 까지 See the Pen NWqXzev by MoonSeonhyeon (@Seonhyeon) on CodePen. 이전 1 2 3 4 5 다음