Skip to content

Instantly share code, notes, and snippets.

@showlovezz
Created April 22, 2020 01:07
Show Gist options
  • Save showlovezz/6d8289e188ee0ebbeab1f9b3f988df53 to your computer and use it in GitHub Desktop.
Save showlovezz/6d8289e188ee0ebbeab1f9b3f988df53 to your computer and use it in GitHub Desktop.
鼠年全馬鐵人挑戰 - Array Filter
var number = [4, 9, 14, 19]
var result = number.filter((value, index, array) => {
return (value % 2 === 1) // % 為餘數運算子
})
console.log(result) // 會得到 [9, 19]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment