JS |
기본 문법홍사훈 0건 849회 21-11-27 23:11 |
---|
관련링크
본문
<< 변수 및 상수 선언 예>>
var a = 1 //변수 선언
let a = 1 //변수 선언
const a = 1 //상수 선언
<< 함수 >>
function add(x, y) { //사용 예제 1
let temp = x + y;
return temp;
}
add = (x, y) => { //사용 예제 2
let temp = x + y;
return temp;
}
<< for문 >>
for (let i = 1; i < 6; i++){ //for문 사용 예제 1
console.log("반복 횟수 : " + i);
}
//for문 사용 예제 2
myArray = [1, 2, 3, 4, 5]
myArray.forEach(element => {
console.log("반복 횟수 : " + element);
});
등록된 댓글이 없습니다.