Last active
May 12, 2024 16:02
-
-
Save emailjohnthomascaballero/100dfe7f016f98244e8f12b27a01c51a to your computer and use it in GitHub Desktop.
This file contains 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
// Remove Duplicate in Array: | |
[...new Set(arr)]; | |
// Removes the first element from an array | |
arr.shift(); | |
// Removes the last element fron an array | |
arr.pop(); | |
// Adds value to the array | |
arr.unshift("John"); | |
// Ascending Order Numbers in Array: | |
arr.sort((a, b) => b - a) | |
// Extracts or Slice the array (starts index 0 then stop in index 2) | |
arr.slice(0, 2) | |
// Check if what type. (String, boolean etc.) | |
typeof array.join(","); | |
// Output First and Last Value of Array: | |
const [firstItem, ...rest] = array; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment