Password Strength Checker In jQuery In Hindi
Calculator In Jquery In Hindi | jQuery Calculator In Hindi
Function object in JavaScript In Hindi | JS Function object
local Storage In JavaScript In Hindi | JS local Storage In Hindi
Optional chaining in JavaScript In Hindi | JS Optional chaining In Hindi
what is switch ? And How switch works ?
Laravel MySQL Best Pratice : Laravel Tips And Tricks
what is CIDR (Classless Inter-Domain Routing or supernetting) In Hindi / CIDR kya hai
Bubble Sort in PHP With Example | How Bubble Sort Works in PHP
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 ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.
Get connected with me. :) LinkedIn Twitter Instagram Facebook