스터디코딩
javascript 3 본문
javascript 함수의 기본문법
f123();
function f123(){
console.log(1);
console.log(2);
console.log(3);
}
APP제작 - 함수를 이용해서 정리 정돈하기
function templateHTML(title, list,body){
return `
<!doctype html>
<html>
<head>
<title>WEB1 - ${title}</title>
<meta charset="utf-8">
</head>
<body>
<h1><a href="/">WEB</a></h1>
${list}
${body}
</body>
</html>
`;
}
function templateList(filelist){
var list = '<ul>'
var i = 0;
while(i<filelist.length){
list = list + `<li><a href="/?id=${filelist[i]}">${filelist[i]}</li>`
i = i+1;
}
list = list + '</ul>'
return list;
}
var list = templateList(filelist);
var template = templateHTML(title, list, ` <h2>${title}</h2><p>${description}</p>`);
'nodejs' 카테고리의 다른 글
[node.js / s3] node 백엔드에서 s3로 이미지 업로드(multer) (0) | 2022.02.17 |
---|---|
[node.js/express] 라우터 분리하기 (0) | 2021.12.05 |
[Node.js] Request param,query, body 의 차이점 (0) | 2021.12.04 |
[Express] (0) | 2021.12.02 |
Nodejs에서 동기와 비동기 1 (0) | 2021.11.28 |
Comments