Logical Operators In JavaScript In Hindi | JS Logical Operators In Hindi
Important JavaScript Interview Questions In Hindi
JavaScript Web Worker Example | Web Workers In JavaScript In Hindi
Ternary Operator In JavaScript In Hindi | JavaScript Conditional Operator In Hindi
Calculator In Jquery In Hindi | jQuery Calculator In Hindi
Back end developer roadmap : how to became back end developer ? back end development kya hai?
Private and Public IP Addresses In Hindi
What is DHCP In Hindi? DHCP kya hai?
Variables In Snowflake In Hindi | Snowflake Variables In Hindi
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
तो जैसा कि आप जानते हैं कि JavaScript में Objects key : value
pair में data contain करता है। value में आप Array , Object या Functions कुछ भी रख सकते हैं।
JavaScript Object.values, entries
इस article में हम JavaScript में Objects के predefined 3 methods की बात करेंगे जो काफी useful हैं।
keys()
methods किसी Object में available सभी properties का एक Array return करता है।
Example :
let user = {
name : 'Ravi',
age : 25,
address : 'UP, India'
};
console.log(Object.keys(user));
Output :
Array(3) [ "name", "age", "address" ]
अगर Object empty है तो आपको empty Array मिलेगा।
values()
methods किसी Object में available सभी property values का एक Array return करता है।
Example :
let user = {
name : 'Ravi',
age : 25,
address : 'UP, India'
};
console.log(Object.values(user));
Output :
Array(3) [ "Ravi", 25, "UP, India" ]
entries()
method की help से आप Object की property और value को Array में convert कर सकते हैं।
Example :
let user = {
name : 'Ravi',
age : 25,
address : 'UP, India'
};
console.log(Object.entries(user));
Output :
Array(3) 0: Array [ "name", "Ravi" ] 1: Array [ "age", 25 ] 2: Array [ "address", "UP, India" ]
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook