Skip to content

Instantly share code, notes, and snippets.

@prashantsani
Last active March 21, 2024 08:56
Show Gist options
  • Select an option

  • Save prashantsani/41cc6f149a084c6df967c2fd788222fe to your computer and use it in GitHub Desktop.

Select an option

Save prashantsani/41cc6f149a084c6df967c2fd788222fe to your computer and use it in GitHub Desktop.
JS Array Input and Output
'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