Answers for "last item in object javascript"

2

las element of object

var fruitObject = { 'a' : 'apple', 'b' : 'banana', 'c' : 'carrot' };
Object.keys(fruitObject); // this returns all properties in an array ["a", "b", "c"]
fruitObject[Object.keys(fruitObject)[Object.keys(fruitObject).length - 1]] // "carrot"
Posted by: Guest on November-22-2020
0

javascript how to get last property of object

fruitObject[Object.keys(fruitObject)[Object.keys(fruitObject).length - 1]] // "carrot"
Posted by: Guest on August-06-2021
0

last element id javascript

<div id='print'>

                <p id=1>some data</p>
                <p id=2>some data</p>
                <p id=3>some data</p>
                <p id=4>some data</p>
                <p id=5>some data</p>

          </div>
Posted by: Guest on July-26-2020

Code answers related to "last item in object javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language