Skip to content

Instantly share code, notes, and snippets.

@phptuts
Last active July 3, 2023 23:54
Show Gist options
  • Save phptuts/f1798c200bf62d6b8caa871871ba33e7 to your computer and use it in GitHub Desktop.
Save phptuts/f1798c200bf62d6b8caa871871ba33e7 to your computer and use it in GitHub Desktop.
day-12-js
let colors = [];
colors.push('red');
colors.push('green');
colors.push('blue');
colors.unshift('yellow');
console.log(colors, 'colors');
const colors = ['red', 'green', 'blue', 'yellow', 'red'];
const noReds = colors.filter(c => c !== 'red');
console.log(noReds, 'noReds');
const colors = ['red', 'green', 'blue', 'yellow', 'red'];
const color = colors.find(c => c === 'purple');
console.log(color, 'color');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment