[JavaScript] String과 Number의 조합과 변환
Javascript에서의 텍스트는 ""(쌍따옴표) 로, 숫자는 ""없이 표현합니다. 숫자를 ""로 감싸게 되면 텍스트로 인식합니다. const a = "1" + "1"; console.log (a) //11 console.loh(typeof a) //string const a = 1 + 1; console.log (a) //2 console.loh(typeof a) //number 텍스트와 숫자의 조합으로 연산해봅시다. console.log ('20' + '2') //202 (typeof:string) console.log ('20' - '2') //18 (typeof:number) console.log ('20' - 2) //18 (typeof:number) console.log (20 - '2') /..
언어/JavaScript
2023. 7. 12. 16:13
- Total
- Today
- Yesterday