Vuejs How to check if array1 has same value in array2?
up vote
-3
down vote
favorite
this is the value of array1:
array1: ['Samsung', 'Apple', 'Asus']
this is the value of array2:
array2: [
{
product_name: 'Phone',
suppliers: [
{company_name: 'Samsung'},
{company_name: 'Apple'},
{company_name: 'Asus'},
]
},
{
product_name: 'Laptop',
suppliers: [
{company_name: 'MSI'},
{company_name: 'Alienware'},
{company_name: 'Dell'},
]
}
]
Problem #1:
My problem is I need to check all suppliers in every index of array2 if array1 is equal to suppliers of array2
Problem #2:
I need to count all equal value of array1 in suppliers of array2
how can I do that using map or any kind of loop?
javascript loops multidimensional-array vue.js
add a comment |
up vote
-3
down vote
favorite
this is the value of array1:
array1: ['Samsung', 'Apple', 'Asus']
this is the value of array2:
array2: [
{
product_name: 'Phone',
suppliers: [
{company_name: 'Samsung'},
{company_name: 'Apple'},
{company_name: 'Asus'},
]
},
{
product_name: 'Laptop',
suppliers: [
{company_name: 'MSI'},
{company_name: 'Alienware'},
{company_name: 'Dell'},
]
}
]
Problem #1:
My problem is I need to check all suppliers in every index of array2 if array1 is equal to suppliers of array2
Problem #2:
I need to count all equal value of array1 in suppliers of array2
how can I do that using map or any kind of loop?
javascript loops multidimensional-array vue.js
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
this is the value of array1:
array1: ['Samsung', 'Apple', 'Asus']
this is the value of array2:
array2: [
{
product_name: 'Phone',
suppliers: [
{company_name: 'Samsung'},
{company_name: 'Apple'},
{company_name: 'Asus'},
]
},
{
product_name: 'Laptop',
suppliers: [
{company_name: 'MSI'},
{company_name: 'Alienware'},
{company_name: 'Dell'},
]
}
]
Problem #1:
My problem is I need to check all suppliers in every index of array2 if array1 is equal to suppliers of array2
Problem #2:
I need to count all equal value of array1 in suppliers of array2
how can I do that using map or any kind of loop?
javascript loops multidimensional-array vue.js
this is the value of array1:
array1: ['Samsung', 'Apple', 'Asus']
this is the value of array2:
array2: [
{
product_name: 'Phone',
suppliers: [
{company_name: 'Samsung'},
{company_name: 'Apple'},
{company_name: 'Asus'},
]
},
{
product_name: 'Laptop',
suppliers: [
{company_name: 'MSI'},
{company_name: 'Alienware'},
{company_name: 'Dell'},
]
}
]
Problem #1:
My problem is I need to check all suppliers in every index of array2 if array1 is equal to suppliers of array2
Problem #2:
I need to count all equal value of array1 in suppliers of array2
how can I do that using map or any kind of loop?
javascript loops multidimensional-array vue.js
javascript loops multidimensional-array vue.js
asked Nov 7 at 9:11
Gerard Mendiola
11
11
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16
add a comment |
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186387%2fvuejs-how-to-check-if-array1-has-same-value-in-array2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
this question could help you stackoverflow.com/questions/38811421/…
– Boussadjra Brahim
Nov 7 at 9:16