Update descriptions of some older type snippets
This commit is contained in:
@ -5,7 +5,8 @@ tags: type,beginner
|
||||
|
||||
Returns the native type of a value.
|
||||
|
||||
Returns lowercased constructor name of value, `"undefined"` or `"null"` if 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, `String.prototype.toLowerCase()` to return it in lowercase.
|
||||
|
||||
```js
|
||||
const getType = v =>
|
||||
@ -14,4 +15,4 @@ const getType = v =>
|
||||
|
||||
```js
|
||||
getType(new Set([1, 2, 3])); // 'set'
|
||||
```
|
||||
```
|
||||
|
||||
@ -5,7 +5,7 @@ tags: type,beginner
|
||||
|
||||
Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.
|
||||
|
||||
Use the strict equality operator to check if the value and of `val` are equal to `null` or `undefined`.
|
||||
Use the strict equality operator to check if the value of `val` is equal to `null` or `undefined`.
|
||||
|
||||
```js
|
||||
const isNil = val => val === undefined || val === null;
|
||||
@ -14,4 +14,4 @@ const isNil = val => val === undefined || val === null;
|
||||
```js
|
||||
isNil(null); // true
|
||||
isNil(undefined); // true
|
||||
```
|
||||
```
|
||||
|
||||
@ -5,7 +5,7 @@ tags: type,beginner
|
||||
|
||||
Returns `true` if the specified value is `null`, `false` otherwise.
|
||||
|
||||
Use the strict equality operator to check if the value and of `val` are equal to `null`.
|
||||
Use the strict equality operator to check if the value of `val` is equal to `null`.
|
||||
|
||||
```js
|
||||
const isNull = val => val === null;
|
||||
@ -13,4 +13,4 @@ const isNull = val => val === null;
|
||||
|
||||
```js
|
||||
isNull(null); // true
|
||||
```
|
||||
```
|
||||
|
||||
@ -5,7 +5,7 @@ tags: type,beginner
|
||||
|
||||
Returns `true` if the specified value is `undefined`, `false` otherwise.
|
||||
|
||||
Use the strict equality operator to check if the value and of `val` are equal to `undefined`.
|
||||
Use the strict equality operator to check if `val` is equal to `undefined`.
|
||||
|
||||
```js
|
||||
const isUndefined = val => val === undefined;
|
||||
@ -13,4 +13,4 @@ const isUndefined = val => val === undefined;
|
||||
|
||||
```js
|
||||
isUndefined(undefined); // true
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user