Understanding setTimeout In JavaScript | JS setTimeout In Hindi
Promise In JavaScript In Hindi | JS Promise constructor
JavaScript Hoisting In Hindi | Hoisting In JavScript
Comma operator In JavaScript In Hindi | JS Comma operator In Hindi
what are callback functions in JavaScript
PHP var_export() Function In Hindi | var_export() In PHP In Hindi
wc Command In Linux | Linux count characters in line or file
Java program to remove duplicate elements from an array
How to Implement RESTful APIs In NodeJS In Hindi | NodeJS RestFul API Example
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 कुछ भी रख सकते हैं।
इस 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