<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
a=3;
console.log( a==3); // 비교연산자를 사용할시에는 결과값이 boolean형태로 나타난다
// > < == ,,,,etc
a = 0; //대입연산자
a == 0; //비교연산자 << 물음표
console.log(a); //a
console.log(a == 0); // true
function a(){
console.log(0);
} // function 정의하고나서 사용하지 않으면 실행 X
//변수와 함수의 사용법 알기
//함수의 매개변수 or 인자값 설정하는 방법
//{} : 코드블럭 << if 문 for문 function
//구구단
hello(5);
function hello(n){
for(i=1; i<=9; i++){
console.log(i*n);
}
}
hello2('e'); //인자값이 없으면 undefined로 나옴
function hello2(a){
console.log(a);
}
hello3();
function hello3(){
for(i=1; i<=10; i++){
if(i == 5){
console.log('hello world');
} else{
console.log(i);
}
}
}
/*3의 배수에만 hello world 표시하기*/
hello4();
function hello4(){
for(i=1; i<=15; i++){
if(i%3 == 0){ // i를 3으로 나눴을때 나머지가 0으로 남냐
console.log('hello world');
} else{
console.log(i);
}
}
}
// 아니면
hello5();
function hello5(){
for(i=1; i<=15; i++){
if(i==3||i==6||i==9||i==12||i==15){
console.log('hello world');
} else{
console.log(i);
}
}
}
/*
if(true){
console.log('if문','Hello World');
}
for(i=0; i<10; i++){
console.log('for문','Hello World');
}
*/
//if문 안에는 boolean만 쓸 수 있다 << 비교연산자만 사용함 << 비교연산자가 boolean형태라서
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
/*
var b='나는 비다'; // var == 전역변수 선언 << script 안에서 다 사용 가능
function hello(){
var b='나는 에이다' //이 지역안에서만 b는 '나는 에이다' 로 친다
console.log(b);
}
hello();
console.log(b);*/
var num=0;
function hello2(){
for(i=0; i<10; i++){
console.log(i,num);
}
num ++;
}
hello2();
hello2();
hello2();
hello2();
hello2();
hello2();
hello2();
hello2();
hello2();
hello2();
</script>
</head>
<body>
</body>
</html>