모던 웹을 위한 Javascript jQuery 책을 보면서 정리하는 내용이다. 

- 복합 대입 연산자의 활용


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script>
 
    window.onload = function () {
        var list = '';
        
        list += '<ul>';
        list +=     '<li>hello</li>';
        list +=     '<li>javaScript</li>';
        list += '</ul>';
        
        //print
        document.body.innerHTML = list;
    };
</script>
</head>
<body>
 
</body>
</html>
cs


- 자료형 검사

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script>
    
    alert(typeof('String'));  // String return
    alert(typeof(123));          // number return
</script>
</head>
<body>
 
</body>
</html>
cs



- 입력(prompt)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script>
 
    var input = prompt('Message''input something');
    
    alert(input);
    
</script>
</head>
<body>
 
</body>
</html>
cs


- 입력(confirm)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script>
 
    var input = confirm('Do you want confirm??');
    
    alert(input);
    
</script>
</head>
<body>
 
</body>
</html>
cs



- Number 함수

prompt 함수를 사용하면 문자열만 입력받을 수 있다. 숫자를 입력하더라도 문자형이 입력된다. 

만약 숫자형으로 값을 받고 싶다면 Number 함수를 사용하면 된다. 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script>
 
    var input = prompt('input number''number');
    var numberInput = Number(input);
    
    alert(typeof(input) + ' : ' + numberInput);         // String : value 
    alert(typeof(numberInput) + ' : ' + numberInput);    // Number : value
</script>
</head>
<body>
 
</body>
</html>
cs


퇴사 관련 이야기들을 모아 책으로 출판했습니다. 

아래 링크에서 전체 목차를 읽어보세요!

대기업 퇴사 이야기 전체보기 : http://www.bookk.co.kr/book/view/21659



아래 링크로 간단한 후기 링크를 남기면 배송비도 환급된다고 하니 참고해주세요.

http://www.bookk.co.kr/community/postscript

+ Recent posts