Replies: 2 comments
-
So all we just have to do is when you a question and it so confusing just
leave it blank and move on with the next one then come back to that
question again when you have more confidence.
…On Sat, 3 Jun 2023, 19:06 Harufuu, ***@***.***> wrote:
let itCompanies = [
"Facebook",
"Google",
"Microsoft",
"Apple",
"IBM",
"Oracle",
"Amazon"
]// Filter out companies which have more than one 'o' without the filter method
I solve it with the For loop, something like this
let filtered_array = [];for(i = 0; i < itCompanies.length; i++) {
let thing = itCompanies[i];
if(thing.indexOf("o") !== thing.lastIndexOf("o")){
filtered_array.push(thing);
}}
console.log(filtered_array) // [ 'Facebook', 'Google', 'Microsoft' ]
The problem is that the loop stuff would first appear in the course on Day
6, while this is a question in the Day 5 exercise. So, I wonder if there is
a solution that does not involve either the filter method or the loop.
—
Reply to this email directly, view it on GitHub
<#772>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7NPDWLOD5WWUPVZUFEEU33XJN4IZANCNFSM6AAAAAAYZNQ5DI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@Harufuu Here, it may help you.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I solve it with the For loop, something like this
The problem is that the loop stuff would first appear in the course on Day 6, while this is a question in the Day 5 exercise. So, I wonder if there is a solution that does not involve either the filter method or the loop.
Beta Was this translation helpful? Give feedback.
All reactions