Skip to content

Commit

Permalink
오하요고자이마스 ~
Browse files Browse the repository at this point in the history
  • Loading branch information
luciancah committed Feb 19, 2024
1 parent 86286ca commit b50822c
Showing 1 changed file with 175 additions and 0 deletions.
175 changes: 175 additions & 0 deletions 08회차(29장~33장)/이진형.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
## 29장 Math

### 29.1 프로퍼티

- `Math.PI`

### 29.2 메서드

(이상하면 NaN)

- `Math.abs` absolute value
- `Math.round` 반올림한 정수
- `Math.ceil` 올림한 정수
- `Math.floor` 내림한 정수
- `Math.sqrt` square root
- `Math.random` 0 ≤ x < 1 사이 실수 난수
- `Math.pow` 첫번째 인수를 밑, 두번째 진수를 지수로 거듭제곱
- `Math.max` 받은것 중에 젤 큰거 (없으면 -INF)
- `Math.min` 받은것 중에 젤 작은거 (없으면 INF)

## 30장 Date

### 30.1 Date 생성자 함수

Date 객체는 UTC 1970.01.01.00:00:00 기점으로 Date 객체가 나타내는 날짜와 시간까지의 밀리초를 나타냄

- `new Date()` 현재 날짜와 시간을 가지는 Date 객체
- `Date()` 날짜와 시간 정보를 나타내는 문자열
- `new Date(milliseconds)` 19700101 기점으로 인수로 전달된 밀리초만큼 경과한 시간과 날짜를 나타내는 Date 객체
- `new Date(dateString)` 지정된 날짜와 시간 나타내는 Date 객체
- `new Date(year, month[,day, hour, minute, second, millisecond])`
연, 월 반드시 지정 - 지정되지 않은 옵션 정보는 0 또는 1로 초기화

### 30.2 Date 메서드

- `Date.now`
- `Date.parse`
- `Date.UTC` 인수 UTC로 인식
- `Date.prototype.getFullYear`
- `Date.prototype.getMonth` 0~11
- `Date.prototype.setMonth`
- `Date.prototype.getDate`
- `Date.prototype.setDate`
- `Date.prototype.getDay` 0~6
- `Date.prototype.getHours`
- `Date.prototype.setHours`
- `Date.prototype.getMinutes`
- `Date.prototype.setMinutes`
- `Date.prototype.getSeconds`
- `Date.prototype.setSeconds`
- `Date.prototype.getMilliseconds` 0~999
- `Date.prototype.setMilliseconds`
- `Date.prototype.getTime` 밀리초 반환
- `Date.prototype.setTime`
- `Date.prototype.getTimezoneOffset` locale ↔ UTC 분단위로 반환
- `Date.prototype.toDateString`
- `Date.prototype.toTimeString`
- `Date.prototype.toISOString` 2020-07-24T03:30:00.000Z
- `Date.prototype.toLocaleString`
- `Date.prototype.toLocaleTimeString`

### 30.3 시계예제

패스

## 31 정규식

### 31.1 정규 표현식이란?

- 일정한 패턴을 가진 문자열의 집합을 표현하기 위해 사용하는 형식 언어
- 문자열 대상의 패턴 매칭 기능 제공

### 31.2 생성

- 정규 표현식 리터럴

```jsx
const regex = /is/i;
```

- RegExp 생성자 함수

```jsx
new RegExp(pattern[, flags])

생성자 함수로 동적으로 생성 가능 ㅋ
```

### 31.3 메서드

- `RegExp.prototype.exec`
인수 문자열에 대해 정규식 패턴 검색하여 매칭 결과를 배열로 반환 (없으면 null)
모든 패턴 검색해도 첫번째 매칭만 반환
- `RegExp.prototype.test`
인수 문자열에 대해 정규식 패턴 검색하여 매칭 결과를 bool 값
- `RegExp.prototype.match
대상 문자열과 인수로 전달받은 정규 표현식과의 매칭 결과를 배열로 반환`

### 31.4 플래그

![스크린샷 2024-02-19 오전 10.24.56.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/d3eeb4e3-6b78-46d1-bac6-edf69767a4e2/40811910-3b32-44a2-8ab0-375d460dd9c8/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA_2024-02-19_%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB_10.24.56.png)

### 31.5 패턴

- 문자열 검색 `/문자열/`
- 임의의 문자열 검색 `/…/`
- 반복 검색 `/{문자열, 문자열}/`
- OR 검색 `|`
- NOT 검색 `/[…]/`
- 시작 위치로 검색 `/^[…]/`
- 마지막 위치로 검색 `$`

## 32 String

### 32.1 생성자 함수

- `new String()`

### 32.2 length 프로퍼티

- `stringValue.length;`

### 32.3 String 메서드

- 변경 불가능한 원시 값이기 때문에 String 래퍼 객체도 읽기 전용 객체로 제공
- `String.prototype.indexOf`
- `String.prototype.search`
- `String.prototype.includes`
- `String.prototype.startsWith`
- `String.prototype.endsWith`
- `String.prototype.charAt`
- `String.prototype.substring`
- `String.prototype.slice`
- `String.prototype.toUpperCase`
- `String.prototype.toLowerCase`
- `String.prototype.trim`
- `String.prototype.repeat`
- `String.prototype.replace`
- `String.prototype.split`

## 33장 Symbol

### 33.1 심벌이란?

- 7번째 데이터 타입 - 변경 불가능 한 원시 타입의 값
- 다른 값과 중복 되지 않는 유일무이한 값 - 주로 이름의 충돌 위험이 없는 유일한 프로퍼티 키를 만들기 위해 사용

### 33.2 심벌 값의 생성

- Symbol 함수
`const mySymbol = Symbol()` ← 값이 외부로 노출되지 않음
- 선택적으로 인수로 문자열 전달 가능 ← 설명 역할만 하며 값 생성에 영향 주지 않음
- 객체처럼 접근하면 암묵적으로 래퍼 객체 생성
- 암묵적으로 문자열이나 숫자 타입으로 변환되지 않음 / 불리언으로는 변환됨
- Symbol.for
- 전역 심벌 레지스트리에서 해당 키와 일치하는 심벌 값 검색
- 검색에 실패하면 새로운 심벌 값을 생성해 저장, 그 값 반환
- Symbol 함수는 호출될 때 마다 유일무이한 심벌 값을 생성하지만 - 전역 심벌 레지스트리에서 심벌 값을 검색할 수 있는 키 지정할 수 없으므로 Symbol.for 사용하면 전역 통해 공유할 수 있음
- Symbol.keyFor
- 전역 심벌 레지스트리에 저장된 심벌 값의 키를 추출할 수 있음

### 33.3 심벌과 상수

- 변경/중복 가능성이 있는 무의미한 상수 값 대신 유일무이한 심벌 값을 사용할 수 있다 ~
- 이넘 칠 때 써라 ~

### 33.4 심벌과 프로퍼티 키

- 객체의 프로퍼티 키를 심벌 값으로 만들 수 있음 (동적으로도)

### 33.5 심벌과 프로퍼티 은닉

- 외부로 노출할 필요가 없는 프로퍼티를 은닉할 수 있음
- for … in / Object.keys / Object.getOwnPropertyNames 메서드로 찾을 수 없음
- Object.getOwnPropertySymbols 메서드 통해서 찾을 수 있음

0 comments on commit b50822c

Please sign in to comment.