오보에블로그
[자바스크립트] 자바스크립트 파일에서 console.log 사용 본문
728x90
console.log(1+2); /*1+2 콘솔에 출력 */
해당 부분의 html, js 파일의 기본 코드 내용에대해 궁금하면
https://pi-314.tistory.com/118
[자바스크립트] 기본 세팅 및 문법
html 기본 틀 작성 (파일 명 : hellow.js , hellow.html) 자바스크립트 defer : 서버에서 hello.js 파일을 가져오고 바로 코드를 실행한다. 그 코드에서 바디를 렌더링 하지 않았으므로,,, 에러....
pi-314.tistory.com
를 참고해주세요
hellow.html
<!DOCTYPE html>
<html lang=ko>
<head>
<meta charset = "utf-8">
<!-- html 글자 깨짐 방지 -->
<title> 자바스크립트</title>
<script src="hellow.js" defer> </script>
<!-- 자바스크립트 파일 불러오기 -->
<!-- <script>
var hello = "hi every one!";
document.body.innerText = hello;
</script> -->
<!-- html 코드에서 자바스크립트 싫행시키기 ; 필수 -->
</head>
<body>
</body>
</html>
hellow.js
var jbRandom = Math.random();
var jbRandom = Math.floor(jbRandom * 10 );
var hello = "안녕하세요";
var nothello = "아니..안녕하세요";
if(jbRandom < 5)
{
document.body.innerText = hello;
};
if(jbRandom >= 5)
{
document.body.innerText = nothello;
};
console.log(jbRandom);
/* 랜덤변수 값 출력 */


728x90
'STEADYSTUDY > 넓고 얕게' 카테고리의 다른 글
[Github] github-pages build error : Liquid Exception: Liquid syntax error (0) | 2022.05.05 |
---|---|
[자바스크립트] Object 사용법 (0) | 2020.07.11 |
[자바스크립트] 기본 세팅 및 문법 (0) | 2020.07.11 |
[WebAssembly] 기본 syntax 의미( semantic) (0) | 2020.07.08 |
webassembly semantic rules (0) | 2020.07.08 |