![]() ![]() An even number will always have a remainder of 0. To do this, we’ll check the remainder of the number divided by 2. Next, we need a function to determine if a number is odd. ![]() What if we have an Array with all even numbers and one odd number? We can find the odd number with Array.find(). If it does, the value of that entry is returned. In the above example we are testing each entry in the array to see if it equals ‘b’. We’ll use an array with three entries: let arr = arr.find(k => k='b') // 'b' find() does not mutate or change the original Array. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |