I have an HTML document as follows.
<div data-map_id="0"></div>
<div data-map_id="0"></div>
<div data-map_id="1"></div>
<div data-map_id="1"></div>
<div data-map_id="0"></div>
<div data-map_id="0"></div>
<div data-map_id="2"></div>
<div data-map_id="2"></div>
I could get an array as follows.
map_id_array=["0", "0", "1", "1", "0", "0", "2", "2"];
But I want to get an array as follows from this array or from HTML directly.
map_id_array=["0", "1", "2"];
How to do this in pure JavaScript?