Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                

<div class="bottom_line">
  <div class="bold">중첩조건문</div>
  <div class="prac_5" id="prac_5">

  </div>
</div>

<div class="bottom_line">
  <div class="bold">Date 객체 메서드</div>
  <div class="prac_4" id="prac_4">

  </div>
</div>

<div class="bottom_line">
  <div class="bold">복합대입 연산자의 활용</div>
  <div class="prac_3" id="prac_3">

  </div>
</div>

<div class="bottom_line">
  <div class="bold">증감연산자</div>
  <div id="prac_2">
    <p id="original"><p>
    <p id="plus"><p>
    <p id="minus"><p>
  </div>
</div>

<div class="bottom_line">
  <div class="bold">재선언오류
  <div id="prac_3">

  </div>
</div>


              
            
!

CSS

              
                .bottom_line{;border-bottom:solid 1px #333; margin-bottom:20px; padding-bottom:20px;}
.bold{font-weight:700; font-size:large; margin-bottom:10px;}

p, li, span{line-height:1.3em;}
              
            
!

JS

              
                //alert("동해물과 백두산이\t마르고 닳도록");

//복합대입 연산자의 활용

window.onload = function(){
  
  var list = '';
  list += '<ul>';
  list +=   '<li>1번째 li</li>';
  list +=   '<li>2번째 li</li>';
  list += '</ul>';

  //document.body.innerHTML = list;
  //document.getElementById('prac_1').innerHTML = list;
  document.getElementsByClassName('prac_1')[0].innerHTML = list;
  
};
 
//증감연산자
var num_2 = 10;

//document.getElementById('prac_2').innerHTML = num_2;
document.getElementById('original').innerHTML = num_2;
num_2++;
num_2++;
document.getElementById('plus').innerHTML = num_2;
num_2--;
num_2--;
document.getElementById('minus').innerHTML = num_2;

//재선언 오류
var alert = 'red Alert';
//alert(alert);
//console.log(alert);

//자료형검사
console.log(typeof ("문자"));
console.log(typeof (123));
console.log(typeof (true));
console.log(typeof (function(){})); // 함수
console.log(typeof ({})); //객체
console.log(typeof(alpha));

//var Input = prompt('숫자를입력해주세요', '숫자');
//var numberInput = Number(Input);
//alert(typeof (input));
//alert(typeof (numberInput) + ': ' + numberInput);

//date 객체 메서드


  
  var date = new Date();
  var GDate = date.getDate();
  var GMonth = date.getMonth()+1;
  var GSeason;

  if(GMonth >= 3 && GMonth <= 5){
    var GSeason = '봄';
  }else{
    var GSeason = '겨울';
  }

  var text4 = '';
  text4 += '<dl>';
  text4 +=  '<dt style="font-weight:700">default</dt>'
  text4 +=    '<dd>';
  text4 +=      date
  text4 +=    '</dd>';
  text4 +=  '<dt style="font-weight:700">date</dt>'
  text4 +=    '<dd>';
  text4 +=      GDate;
  text4 +=    '</dd>';
  text4 +=  '<dt style="font-weight:700">month</dt>'
  text4 +=    '<dd>';
  text4 +=      '지금은' + GMonth + '월 입니다.';
  text4 +=    '</dd>';
  text4 += '</dl>';
  text4 +=  '<dt style="font-weight:700">season</dt>'
  text4 +=    '<dd>';
  text4 +=      '지금 계절은 ' + GSeason + '입니다.';
  text4 +=    '</dd>';
  text4 += '</dl>';
  

  document.getElementById('prac_4').innerHTML = text4;
  

//중첩조건문

var date = new Date();
var hour = date.getHours();
var eat = '';

if(hour < 11){
  var eat = '아침 먹을 시간입니다.'
}else{
  if(hour < 13){
    var eat = '점심 먹을 시간입니다.'
  }else{
    var eat = '저녁 먹을 시간입니다.'
  }
}

document.getElementById('prac_5').innerHTML = eat;

//논리연산자와 조건문
//var score = Number(prompt('학점을 입력하세요.', '4.4'));

	//for 반복문의 특이한 사용
	/* var startTime = new Date().getTime();
	for (var CPS = 0; new Date().getTime() > startTime + 1000; CPS++ )
	{
		alert("초 당 연산 횟수: " + CPS);
	} */

//중첩반복문

	/*
	1-1 : output = *
	1-2 : output = *\n
	2-1 : output = *\n**
	2-2 : output = *\n**\n
	3-1 : output = *\n**\n***
	3-2 : output = *\n**\n***\n

	*/

/* 
	var output = "";
	for(var i=0; i<10; i++){
		output += '*';
	}for (var j=1; j<10 ; j)
	{
		output += '\n';
	}

	alert(output); 
 */
var output="";
for(var i=0; i<10; i++){
 
  output +="*";
}

alert(output);
    
              
            
!
999px

Console