Added few methods to JS Array (#1865)

This commit is contained in:
Saravanakumar J 2022-08-12 03:11:13 +05:30 committed by GitHub
parent 68758d5b26
commit 5fb0ab2a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,8 @@ list = [a,b,c,d,e]
```bash
list[1] // → b
list.indexOf(b) // → 1
list.lastIndexOf(b) // → 1
list.includes(b) // → true
```
### Subsets
@ -81,6 +83,10 @@ list.splice(2, 1) // → [c] list == [a,b,d,e]
.filter(n => ...) => array
```
```bash
.forEach(n => ...)
```
```bash
.find(n => ...) // es6
.findIndex(...) // es6