본문 바로가기

먹고살거/KPI

[자바스크립트]2-2.비교연산자

2-2.자바스크립트의 비교연산자


*두번째(주석을 풀어주세요)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">

<head> <meta http-equiv="content-type" content="applicaton/xhtml+xml;charset=utf-8" />

<title> new document </title>

<script type="text/javascript">

//<![CDATA[



//비교연산자

//2번째

/*

//1.조건

//나이가 30이상이면 참이고 30이하면 거짓이다.

var myAge = prompt("당신의 나이는?");

var result = myAge>=30

console.log(result);

document.write(result+"<br/>");

*/

 

/*

//2.조건

//성별이 남자면 참이고 여자면 거짓이다.

mySex = prompt("당신의 성별은?");

var result = mySex == "남자";


console.log(result);

document.write(result+"<br/>");

*/


/*

//3.조건

//과목이 자바스크립트만 거짓이다.

var mySub = prompt("싫어하는 과목은?");

var result = mySub != "자바스크립트";


console.log(result);

document.write(result+"<br/>");

*/


//]]>

</script>

</head>

<body>


<noscript>

<p>스크립트 지원하지 않음</p>

</noscript>


</body>

</html>