Last active
March 21, 2024 08:56
-
-
Save prashantsani/41cc6f149a084c6df967c2fd788222fe to your computer and use it in GitHub Desktop.
JS Array Input and Output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'hello'. includes('ell'); // true | |
| 'hello'.startswith('hell'); // true | |
| 'hello' endsWith('ello'); // true | |
| '&' . repeat (3); // | |
| 'hello' .codePointAt(1); // 101 | |
| 'hello' .padstart(10); //" hello" | |
| 'hello'.padEnd(10); // "hello " | |
| 'hello this is a statement to check biggest word'.split(' ').reduce((acc, currentValue) => currentValue.length>acc.length ? currentValue : acc , ''); | |
| // output of above --> "statement" | |
| [2, 3, 5].map(item => item*2) // [4,6,10] | |
| [3,50].filter(item => item%2 ===0) //[50] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment