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
HERE ARE 10 AI APPS YOU NEED TO HAVE ON YOUR MOBILE
1. Heardly
→ Save time with 8-min audio book summaries.
→ Heardly APP compresses bestsellers to 10%, offering 8-minute audio and video summaries with AI, saving your reading time everyday.
2. Otter / @otter_ai
→ OtterPilot™ enables AI-powered meetings. Get a meeting assistant that can record audio, take notes, automatically collect slides, and provide summaries.
12 remote jobs paying $80/hr, No Resume No Experience required
1. Gaggle:
→ Gaggle hires content reviewers to monitor online student activities and promote kid safety.
→ Pay ranges from $20 to $25 per hour.
→ Work include identifying potential challenges in K-12 student communications. Flexible scheduling with a minimum of 10 hours each week. Basic technological knowledge and an interest in kid safety are necessary.
2. Preply:
→ Preply is an online tutoring company that provides possibilities in more than 100 courses.
→ Set your own rates, with potential revenues of more than $40 per hour.
→ There is no need for specific qualification; simply be knowledgeable about your field. Create your profile, set your schedule, and begin tutoring in as few as 5 days.