I have these data array dataTimeName
{"imsak":"04:44","fajr":"04:54","sunrise":"06:15","dhuhr":"12:17","asr":"15:40","maghrib":"18:19","isha":"19:31"}
and the JS
$.each(dataTimeName,function(key, val)
{
var current = "15:40";
var previousArray = ""; //<-- how to get the previous from current?
});
My question is how to get the previous value from the current 15:40 from dataTimeName list?
It means, I will get previous value before 15:40 is 12:17.
var dataTimeName = {"imsak":"04:44","fajr":"04:54","sunrise":"06:15","dhuhr":"12:17","asr":"15:40","maghrib":"18:19","isha":"19:31"};
$.each(dataTimeName,function(key, val)
{
var current = "15:40";
var previousArray = ""; //<-- how to get the previous from current?
alert(val);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
[ "04:44", "04:54", "06:15", "12:17", "15:40", "18:19", "19:31" ]