-
Notifications
You must be signed in to change notification settings - Fork 0
Math
Hyunseung Ryu edited this page Apr 30, 2023
·
3 revisions
_(this).max()객체의 최댓값을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
Returns
| type | description |
|---|---|
* |
객체의 최댓값 |
Examples
_([1, 2, 3]).max(); // 3
_(new Set([1, 2, 3])).max(); // 3_(this).maxBy([by=(e => e)])객체의 요소 중 by 함수의 반환값이 가장 큰 요소를 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
| [by=(e => e)] | Function |
요소마다 호출할 함수, 첫번째 인자는 요소(value) |
Returns
| type | description |
|---|---|
* |
by 함수의 반환값이 가장 큰 요소 |
Examples
_([{a: 1}, {a: 2}, {a: 3}]).maxBy(v => v.a); // {a: 3}_(this).min()객체의 최솟값을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
Returns
| type | description |
|---|---|
* |
객체의 최솟값 |
Examples
_([1, 2, 3]).min(); // 1
_(new Set([1, 2, 3])).min(); // 1_(this).minBy([by=(e => e)])객체의 요소 중 by 함수의 반환값이 가장 작은 요소를 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
| [by=(e => e)] | Function |
요소마다 호출할 함수, 첫번째 인자는 요소(value) |
Returns
| type | description |
|---|---|
* |
by 함수의 반환값이 가장 작은 요소 |
Examples
_([{a: 1}, {a: 2}, {a: 3}]).minBy(v => v.a); // {a: 1}_(this).product()객체의 모든 요소의 곱을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
Returns
| type | description |
|---|---|
* |
객체의 모든 요소의 곱 |
Examples
_([2, 2, 3]).product(); // 12
_(new Set([2, 3, 4])).product(); // 24_(this).productBy([by=(e => e)])객체의 모든 요소의 곱을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
| [by=(e => e)] | Function |
요소마다 호출할 함수, 첫번째 인자는 요소(value) |
Returns
| type | description |
|---|---|
* |
객체의 모든 요소의 곱 |
Examples
_([{a: 2}, {a: 3}, {a: 4}]).productBy(v => v.a); // 24_(this).sum()객체의 모든 요소의 합을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
Returns
| type | description |
|---|---|
* |
객체의 모든 요소의 합 |
Examples
_([2, 3, 4]).sum(); // 9
_(new Set([2, 3, 4])).product(); // 9_(this).sumBy([by=(e => e)])객체의 모든 요소의 합을 반환합니다.
Parameters
| name | type | description |
|---|---|---|
| this | Array | Set |
순회할 객체 |
| [by=(e => e)] | Function |
요소마다 호출할 함수, 첫번째 인자는 요소(value) |
Returns
| type | description |
|---|---|
* |
객체의 모든 요소의 합 |
Examples
_([{a: 1}, {a: 2}, {a: 4}]).sumBy(v => v.a); // 7