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>
Please follow and like us:
Content Protection by DMCA.com