.trim() : string, remove space
.toUpperCase() : string, change to Uppercase
.toLowerCase() : string, change to Lowercase
.indexOf() : string, 텍스트 설정 후 순번을 숫자로 표기
.slice() : number, 어느 지점부터 어느 지점까지를 숫자로 표기(start, end) end는 미포함. -가 붙을 경우 끝에서부터 count
.replace() : string, 이 단어를 저 단어로 변경
.replaceAll() : string, 이 단어를 저 단어로 모두 변경
.length : string, 문자 길이 표시
prompt : 입력창 표시 후 정보 입력이 데이터가 된다.
Template Literals
Math.PI : 원주율 값
Math.round : 소수점 이하 반올림
Math.abs : 절대값
Math.ceil : 소수점 이하 올림
Math.floor : 소수점 이하 버림
Math.pow : 제곱근 ex) Math.pow(2,3) = 2 * 3
Math.min : 최소값
Math.max : 최대값
Math.random : 0이하 랜덤 값 ex) 주사위 : Math.floor(Math.random() 6) + 1
let random = Math.random
if (random < 0.5) {
console.log("THIS NUMBER IS LESS THAN 0.5")
console.log(random)
}
== 와 === 의 차이 : ==는 값만 동일하면 true ===는 값, 속성 둘다 동일해야 true
console.log : print의 개념
console.warn : 경고문
console.error : 오류문
alert : 안내창 표시
prompt : 입력창 표시
parse.Int : sting -> number 변환
Number
String
Boolean
Null
Undefined
else if : if의 조건이 true가 아닐 경우 else if의 조건을 따른다.
else : 모든 조건이 true가 아닐 경우 else의 조건을 따른다.
&& : 조건문 내 and 역할. 두 조건 중 하나라도 false이면 false. ex) if (password.length >= 6 && password.indexOf(' ')
|| : 조건문 내 or 역할. 두 조건 중 하나라도 true이면 true.
switch : ex)
array : [] ex) let colors = ['red', 'blue', 'green']
add array : ex) colors[3] = 'black' -> ['red', 'blue', 'green', 'black']
ex) colors[1][1] = 'yellow' -> [['blue', 'red'], ['green', 'yellow']]
.push() : add array to the end
.pop() : remove from end
.shift() : remove from start
.unshift() : add array to start
.concat() : merge array A to B
.includes() : check array it is true or false
.reverse() : reverse arrays(change)
.splice() : 사이에 끼워넣거나 지울 수 있다. (start, delete, string)
.sort() : sort array 앞자리에 한해서 정렬한다.