for loop is used when you want to execute a block of code as long as a specified condition is true.
Syntax :
Examples:
2. for Each:
The forEach() method calls a function (a callback function) once for each array element.
Syntax :
Example:
Note:- the function takes 3 arguments:
The item value.
The item index.
The array itself.
The example below uses only the value parameter.
3. for...of:
The for...of statement creates a loop Iterating over iterable objects , invoking a custom iteration hook with statements to be executed for the value of each distinct property.
Syntax:
Example:
4. for...in:
The for...in statement loops over all of an object's enumerable properties that are keyed by strings (ignoring those keyed by Symbols), including inherited enumerable properties.
Syntax:
Example:
5. map :
The map() method will iterate through the Array elements individually and it will perform some Operations.
Operations might be: Printing, Finding the length of the String, Concatenation, etc.
The method creates a new array by performing a function on each array element
The map() method does not execute the function for array elements without values.
The map() method does not change the original array.
Example:
6. reduce()
The reduce() method runs a function on each array element to produce (reduce it to) a single value.
The reduce() method works from left to right in the array.
The reduce() method does not reduce the original array.
If you enjoyed reading this thread, please do the following: 1. Retweet the first tweet. 2. Follow me and enable notifications: @mujeeb0147.
Thank you for reading all the way through.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Access ChatGPT-o1, DeepSeek-R1, Claude, Gemini, Llama, Grok, Midjourney, Ideogram, Flux Perplexity, Runway and Luma all in one place. Enjoy advanced AI models, image/video creation, and web search.
Here's how ↓
Meet GlobalGPT @GlbGPT - Your Ultimate All-In-One AI Platform.
Access ChatGPT 4.1, Midjourney v7, Grok 3, Claude 3.7, DeepSeek, Gemini, Llama 4, Flux, Ideogram, Perplexity, Runway, Luma, and more—all in one platform.
10 AI websites to finish a day’s work in just 1 hour
[Bookmark This 🔖]
1. Flot AI - Anywhere AI Assistant
Download for Free →
→ Flot is the all-in-one AI assistant that helps you write better, read faster, and remember information across any apps and websites.
→ Built-in the latest ChatGPT, Claude, Gemini, etc. Flot.ai
AiSOAP - #1 AI Medical Scribe with AI SOAP Notes
Try it free today! 🔗
Trust me, it’s a game-changer. 💥
→ AiSOAP records, transcribes, and generates customized SOAP notes, saving you 95% of your charting time. Sounds too good to be true? It’s not. 🙌Try.aisoap.com
• Transforms blurry ideas into actionable and data-backed analysis within 2 minutes.
• Turn weeks of inspiration researches into seconds, saving 99% of time
• Launch business with confidence, knowing market trends and optimized sourcing recommendation with suppliers thoroughly assessed and recommended.
• Gain business success faster!
2. MyScript Nebo / @myscript
→ Transforms text prompts into stunning, watermark-free images, allowing users to generate up to five artworks daily for free.
→ Offers extensive customization with different models, styles, aspect ratios, and starting photos.
→ Unlock daily trading opportunities with real-time event-driven insights & technical signals
→ Simplified, powerful tools for the intraday bottom and top signals—trade like a pro, effortlessly!
2. Spiking
→ The AI-powered stock tracking platform for smarter investments!
→ Leverage AI-driven insights to track market moves like the pros.
→ Get real-time data on what top investors are buying and selling.