Update guidelines regarding arguments
This commit is contained in:
@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00
|
|||||||
|
|
||||||
Checks if the bottom of the page is visible.
|
Checks if the bottom of the page is visible.
|
||||||
|
|
||||||
- Use `scrollY`, `scrollHeight` and `clientHeight` to determine if the bottom of the page is visible.
|
- Use `Window.scrollY`, `Element.scrollHeight` and `Element.clientHeight` to determine if the bottom of the page is visible.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const bottomVisible = () =>
|
const bottomVisible = () =>
|
||||||
|
|||||||
@ -10,7 +10,7 @@ If the given string contains multiple elements, only the first one will be retur
|
|||||||
|
|
||||||
- Use `Document.createElement()` to create a new element.
|
- Use `Document.createElement()` to create a new element.
|
||||||
- Use `Element.innerHTML` to set its inner HTML to the string supplied as the argument.
|
- Use `Element.innerHTML` to set its inner HTML to the string supplied as the argument.
|
||||||
- Use `ParentNode.firstElementChild` to return the element version of the string.
|
- Use `Element.firstElementChild` to return the element version of the string.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const createElement = str => {
|
const createElement = str => {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ lastUpdated: 2020-10-19T22:49:51+03:00
|
|||||||
Returns the native type of a value.
|
Returns the native type of a value.
|
||||||
|
|
||||||
- Return `'undefined'` or `'null'` if the value is `undefined` or `null`.
|
- Return `'undefined'` or `'null'` if the value is `undefined` or `null`.
|
||||||
- Otherwise, use `Object.prototype.constructor.name` to get the name of the constructor.
|
- Otherwise, use `Object.prototype.constructor` and `Function.prototype.name` to get the name of the constructor.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const getType = v =>
|
const getType = v =>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ lastUpdated: 2020-10-20T23:02:01+03:00
|
|||||||
Checks if the provided value is of the specified type.
|
Checks if the provided value is of the specified type.
|
||||||
|
|
||||||
- Ensure the value is not `undefined` or `null` using `Array.prototype.includes()`.
|
- Ensure the value is not `undefined` or `null` using `Array.prototype.includes()`.
|
||||||
- Compare the `constructor` property on the value with `type` to check if the provided value is of the specified `type`.
|
- Use `Object.prototype.constructor` to compare the constructor property on the value with `type` to check if the provided value is of the specified `type`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
|
const is = (type, val) => ![, null].includes(val) && val.constructor === type;
|
||||||
|
|||||||
Reference in New Issue
Block a user