CodesJava

Easy learning with example program codes

Object.entries() JavaScript

The Javascript Object entries() method gives an array with enumerable property key-value pairs of a specified object.

Syntax:

Object.entries(object) 

Parameters:
object: It represents the object whose enumerable property key-value pairs have to be get.

Return:
An array with enumerable property key-value pairs.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
const a = { 10: 'BRONZE', 20: 'SILVER', 30: 'PLATINUM', 40: 'GOLD', 50: 'DIAMOND' };  
document.write(Object.entries(a)[4]);    
</script>
</body>
</html>

Output:

50,DIAMOND
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status