Calculate the number of weekday and weekend hours between 2 timestamp params in javascript

I want to calculate the number of weekday-hours and weekend-hours within a given 2 timestamp range. It is sure the timestamp ranges are in hours, it doesn’t contain minutes or seconds values in it. attempt: function getWeekdayWeekendHours(fromTimestamp, tillTimestamp) { let weekdayhours = 0; let weekendhours = 0; // fix the GMT issue by decreasing timestamp…

Confusion of setInterval with setTimeout in JavaScript

I am trying to use setInterval with setTimeout in JavaScript. var temArr = [] let timer = setInterval(() => { var target = Math.random() temArr.push(target) console.log(6, target, temArr[temArr.length – 1], target === temArr[temArr.length – 1]) // one setTimeout(() => { console.log(9, target, temArr[temArr.length – 1], target === temArr[temArr.length – 1]) // two }, 500); },…

Get class name value on click javascript

<div class=”Container”> <div class=”one two three four”> <div class=” five”> <ul> <li class=”a productOne c”><a class=”one two” title=”Product One” href=”#”>Product One</a></li> <li class=”a productTwo c”><a class=”one two” title=”Product Two”href=”#”>Product Two</a></li> <li><a class=”favourites” title=”favourites” href=”#”>Favourites</a></li> </ul> </div> </div> </div> I want to create a click event to capture the product value using Javascript. I have tried…