Created
April 22, 2020 01:07
-
-
Save showlovezz/6d8289e188ee0ebbeab1f9b3f988df53 to your computer and use it in GitHub Desktop.
鼠年全馬鐵人挑戰 - Array Filter
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
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