How can i filter javascript Object? [on hold]
up vote
-3
down vote
favorite
var obj =;
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-2"] = { "name": "gopal", "age" : 15, "dept" : "testing" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
obj["emp-4"] = { "name": "prakash", "age" : 25, "dept" : "designing" };
How to retrieve employees from dept="development" like
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
javascript object-oriented array
New contributor
put on hold as unclear what you're asking by Toby Speight, πάντα ῥεῖ, t3chb0t, konijn, RobH 2 days ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-3
down vote
favorite
var obj =;
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-2"] = { "name": "gopal", "age" : 15, "dept" : "testing" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
obj["emp-4"] = { "name": "prakash", "age" : 25, "dept" : "designing" };
How to retrieve employees from dept="development" like
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
javascript object-oriented array
New contributor
put on hold as unclear what you're asking by Toby Speight, πάντα ῥεῖ, t3chb0t, konijn, RobH 2 days ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
var obj =;
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-2"] = { "name": "gopal", "age" : 15, "dept" : "testing" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
obj["emp-4"] = { "name": "prakash", "age" : 25, "dept" : "designing" };
How to retrieve employees from dept="development" like
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
javascript object-oriented array
New contributor
var obj =;
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-2"] = { "name": "gopal", "age" : 15, "dept" : "testing" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
obj["emp-4"] = { "name": "prakash", "age" : 25, "dept" : "designing" };
How to retrieve employees from dept="development" like
obj["emp-1"] = { "name": "gogul", "age" : 10 , "dept" : "development" };
obj["emp-3"] = { "name": "gowtham", "age" : 20, "dept" : "development" };
javascript object-oriented array
javascript object-oriented array
New contributor
New contributor
edited 2 days ago
New contributor
asked 2 days ago
Gogul
12
12
New contributor
New contributor
put on hold as unclear what you're asking by Toby Speight, πάντα ῥεῖ, t3chb0t, konijn, RobH 2 days ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Toby Speight, πάντα ῥεῖ, t3chb0t, konijn, RobH 2 days ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago
add a comment |
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
-1
down vote
for (var i = 0; i < obj.length; i++) {
if (obj[i].dept == "development") {
// filtered data
}
}
if you want to use this data in another block you can create new array and push every filtered data.
New contributor
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
for (var i = 0; i < obj.length; i++) {
if (obj[i].dept == "development") {
// filtered data
}
}
if you want to use this data in another block you can create new array and push every filtered data.
New contributor
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
add a comment |
up vote
-1
down vote
for (var i = 0; i < obj.length; i++) {
if (obj[i].dept == "development") {
// filtered data
}
}
if you want to use this data in another block you can create new array and push every filtered data.
New contributor
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
add a comment |
up vote
-1
down vote
up vote
-1
down vote
for (var i = 0; i < obj.length; i++) {
if (obj[i].dept == "development") {
// filtered data
}
}
if you want to use this data in another block you can create new array and push every filtered data.
New contributor
for (var i = 0; i < obj.length; i++) {
if (obj[i].dept == "development") {
// filtered data
}
}
if you want to use this data in another block you can create new array and push every filtered data.
New contributor
New contributor
answered 2 days ago
xamt
1
1
New contributor
New contributor
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
add a comment |
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
1
1
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review. Please refuse to answer off-topic questions.
– Heslacher
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
Welcome to Code Review! Please refrain from answering low-quality questions that are likely to get closed. Once, you've answered, that limits what can be done to improve the question, making it more likely that your efforts are wasted. It's better to wait until the question is properly ready before you answer!
– Toby Speight
2 days ago
add a comment |
Hi! We only review existing and working code. This question will get closed.
– konijn
2 days ago