Search algorithm / map / forEach
Search algorithm / map / forEach

๐ Hi there! I'm Suzie, a developer who began my coding journey in 2023. Iโm passionate about building fast and dynamic web experiences using Next.js, JavaScript, and Tailwind CSS.
๐ฑ As I grow in tech, I enjoy documenting my learning journey and sharing insights to help others navigate their path.
โจ Fun fact: When Iโm not coding, you can find me practicing Capoeria ๐คธ.
Letโs connect, learn, and create together!
CS50
Search algorithm
- Linear Search : it is a method for finding an element within a list. it sequentially checks each element of the list until a match is found or the whole list has been searched.
- Binary Search : a.k.a half-interval search. it finds the position of a target value within a sorted array. it compares the target value to the middle element of the array.

Udemy
forEach() vs map()

both forEach() & map() create loop but I didn't know what the differences are. but today I had a Angela's lecture and got to know what are those! since forEach does not return anything, we need to make an array to push the result in. However, map doesn't need to do so since it automatically returns an array.

![[TypeScript] Understanding Generic Functions](https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/NH0pmKaZeuk/upload/47eb76a03d44ea841c42f406a93de157.jpeg)
