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" };









share|improve this question









New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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















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" };









share|improve this question









New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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













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" };









share|improve this question









New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question









New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago





















New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









Gogul

12




12




New contributor




Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Gogul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




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


















  • 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










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.






share|improve this answer








New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 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 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.






share|improve this answer








New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 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















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.






share|improve this answer








New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 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













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.






share|improve this answer








New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









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.







share|improve this answer








New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered 2 days ago









xamt

1




1




New contributor




xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






xamt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 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




    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



Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin