JS confirm() / .split() / string()

hihihiha2·2022년 6월 6일
0

javascript confirm()

confirm(메시지 문자열)
boolean값을 입력받고 싶을때

const input = confirm ('OO하시겠습니까?')
alert(input)

*prompt()와 비슷
prompt(): 문자열을 입력받고 싶을때
confirm(): 불 값을 입력받고 싶을때

  1. confirm('지금 피곤합니까')
  2. 확인버튼을 클릭 - true를 리턴
  3. 취소버튼을 클릭 - false를 리턴

javascript .split()

문자열자르기

const 한글 = '가,나,다,라,마,바,사,아'.split(',')
console.log(한글) 

'','','','','','','',''

javascript string()

문자열 자료형으로 변환하기
string(자료)

string(true)

"true"

불 자료형이 문자열 자료형으로 변환됨

문자열 자료형으로 변환하기2
빈문자열 더하기

+ ""
500 + ""

"500"

오늘의 단축키

Vs code에서 터미널 열기 / 닫기
command + J

profile
맨땅에 헤딩

0개의 댓글