리액트 전 자바스크립트 간단정리

5o_hyun·2022년 12월 16일
0
post-thumbnail

자바스크립트 자료형

// number type
let num1 = 1234;
let num2 = 5.678;

// string type
let str1 = "hello";

// boolean type
let bol1 = "true";
let bol2 = "false";

// null type : 값이 정의됬는데 그값이 null
let null = null; 

// undefined type : 값이 정의되지않음 
let un1;
let un2 = undefined;

// array type
let arr = [1,2,3];

자바스크립트 연산자

산술연산자 + - * / % **
대입연산자 += -= *= /=
증가,감소연산자 a++ --a
비교연산자 < > <= >=
동등연산자 == !=
일치연산자 === !--
논리연산자 && ||
삼항연산자 조건식?true일때:false일때

자바스크립트 함수

// 기본형
function sum (a,b){
  return a + b;
}
// 화살표함수형
const sum = (a,b) => {
  return a + b;
}
profile
학생 점심 좀 차려

0개의 댓글